【问题标题】:android dotted line with targetSdkVersion=17 changes to a lineandroid虚线targetSdkVersion=17变为一行
【发布时间】:2014-02-15 23:30:41
【问题描述】:

我有dotted_line_horizo​​ntal.xml:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="line" >
    <stroke
        android:dashGap="10px"
        android:dashWidth="10px"
        android:color="#5c5c5c" />

</shape>

我用这个作为背景:

   <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@drawable/dotted_line_horizontal" />

当我设置 android:targetSdkVersion="8" 一切都很好,我可以看到虚线。当我更改为 android:targetSdkVersion="17" 我的虚线变成了一条线。为什么?

【问题讨论】:

    标签: android android-layout android-view dotted-line


    【解决方案1】:

    添加&lt;solid&gt; 标记,如this answer 中指定的那样。

    <solid android:color="#ffffff" />
    

    这将确保破折号部分与空白部分的颜色不同。

    【讨论】:

    • 它没有帮助。还是那一行。
    猜你喜欢
    • 2017-04-14
    • 2013-08-02
    • 1970-01-01
    • 1970-01-01
    • 2020-02-01
    • 1970-01-01
    • 2012-08-14
    • 1970-01-01
    • 2014-04-15
    相关资源
    最近更新 更多