Matt Matt - 1 year ago 128
Android Question

Border in shape xml

I am trying to make a drawable to use for a button. I would like it to have this coloring, with a 2px border around it.

Everything works just fine except I cannot get the border to show up...

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android=""
android:shape="rectangle" >

<gradient android:startColor="@color/bar_clicked_dark"

<corners android:bottomLeftRadius="0dp"
android:topRightRadius="0dp" />

<stroke android:width="2px"
android:color="#ff00ffff" />


Thanks in advance for any help!

Answer Source

It looks like you forgot the prefix on the color attribute. Try

 <stroke android:width="2px" android:color="#ff00ffff"/>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download