android dashed border with padding

喜夏-厌秋 提交于 2019-12-08 17:09:28

问题


i have a RadioGroup

I would like to add a dashed stroke(boder?) with some padding.

The background of Radio Buton is

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/navigation"/>
    <item >
        <shape>
            <solid android:color="#00000000"/>
            <stroke android:color="#ffffff"
                    android:dashGap="5dp"
                    android:dashWidth="5dp"/>
        </shape>
    </item>
</layer-list>

The second item - is my attemp to draw dashed line.

What am i doing wrong?


回答1:


Try adding android:width="1dip" to your <stroke> tag.




回答2:


I think this will help you.

try this.

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <shape>
            <solid android:color="#ffffff" />
            <stroke
                android:dashGap="5dp"
                android:dashWidth="5dp"
                android:width="1dp"
                android:color="#0000FF" />
            <padding
                android:bottom="5dp"
                android:left="5dp"
                android:right="5dp"
                android:top="5dp" />
        </shape>
    </item>
</layer-list>


来源:https://stackoverflow.com/questions/11922801/android-dashed-border-with-padding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!