how to make stroke for 3 sides for a shape in android? -


i using stroke make colored border shape in xml layout in android .

can make stroke 3 edges ( left,top,bottom) right no ?

you can achieve using layerlist , messing padding. you'll need 3 elements:

1: border.xml shape, solid shape in color of border: border.xml

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android">     <solid android:color="#ff0000"/> </shape> 

2: 'inner' shape, shape want border appear around: inner.xml

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android">     <solid android:color="#00ff00"/> </shape> 

3: layer list, put these 2 on top of eachother. create border setting padding on inner shape: layerlist.xml

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/border"/> <item android:drawable="@drawable/inner"     android:top="3dp" android:right="0dp" android:bottom="3dp"     android:left="3dp" /> </layer-list> 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -