Android 形状错误在哪个 Android 版本上

标签 android shapes android-drawable

我创建了一组在 Android 4.4 上完美运行的形状: enter image description here 然而,当我在2.3上测试它时: enter image description here 底角调换了,凝结了(很可能是高度问题)。 因此,我决定创建一个类似 drawable-v14 的文件夹,并为不同版本分配不同的形状,但我需要知道哪些 Android 版本存在错误。我无法在所有版本上测试它!

编辑
7 号按钮的形状:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <shape android:shape="rectangle">

            <solid android:color="@color/rounded_stroke_color" />

            <corners
                android:topLeftRadius="0dp"
                android:topRightRadius="0dp"
                android:bottomLeftRadius="@dimen/rounded_radius_default"
                android:bottomRightRadius="0dp" />

        </shape>
    </item>
    <item
        android:top="@dimen/rounded_stroke_normal_half"
        android:bottom="@dimen/rounded_stroke_normal"
        android:left="@dimen/rounded_stroke_normal"
        android:right="@dimen/rounded_stroke_normal_half">
        <shape android:shape="rectangle">

            <solid android:color="@color/rounded_fill_color" />

            <corners
                android:topLeftRadius="0dp"
                android:topRightRadius="0dp"
                android:bottomLeftRadius="@dimen/rounded_radius_default"
                android:bottomRightRadius="0dp" />

            <padding
                android:left="@dimen/rounded_padding_left"
                android:right="@dimen/rounded_padding_right" />

        </shape>
    </item>
</layer-list>

顺便说一句,这些值存储在不同的资源文件中。

最佳答案

好的,让我们从您的代码开始。 首先,您不需要为此拥有图层列表。你可以这样做:

<shape android:shape="rectangle">

            <solid android:color="@color/rounded_stroke_color" />
            <stroke android:color="@color/comments_dark_color" android:width="@dimen/stroke_width"/>
            <corners
                android:topLeftRadius="0dp"
                android:topRightRadius="0dp"
                android:bottomLeftRadius="@dimen/rounded_radius_default"
                android:bottomRightRadius="0dp" />

        </shape>

关于角的问题,你是对的。这是已知错误https://code.google.com/p/android/issues/detail?id=9161 。此错误已在 android 3.1 中修复

正如 @DerGolem 所说,有黑客攻击:

Lucky us, there is a workaround: the workaround is to put the "correct" drawbles in the drawable-v12 folder, and the reversed ones in the drawable folder

关于Android 形状错误在哪个 Android 版本上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23647320/

相关文章:

android - 使用 path.lineTo() 时对角线看起来比直线粗

image-processing - 不规则形状的 OpenCV 质心

c# - Powerpoint 中形状的部分下划线检查不起作用?

Android Studio 3.1.4 : java. time.LocalDate”不支持

java 日期格式错误响应

具有圆形或弧段的 CSS 剪辑/路径/蒙版/形状动画

android - 将文件名的 ArrayList 转换为 Android 资源

android - 延迟显示图像在android中使用位图

安卓微调器 : Avoid onItemSelected calls during initialization

java - 使用 Kotlin 创建自定义 Dagger 2 范围