开发者

Border texture for a View

Is there any way to set border texture for LinearLayout or any other View? I can't just set an image as the background because of different screen sizes.

Here is the sample of the texture I'm talking about:

Border texture for a View

I tried to use Nine-patch, but it stretches the white lines that are suppos开发者_如何学编程ed to be repeated.

Screenshot from Draw 9-patch tool:

Border texture for a View


You can use shape drawable like this:

<shape android:shape="rectangle">
    <solid android:color="#FAFAD2" />           
    <stroke android:width="1sp" android:color="#000000"
        android:dashWidth="7sp" android:dashGap="5sp" />
</shape>

and this will result you something like this:

Border texture for a View

You can change color, width, border etc according to your requirements.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜