Reputation: 99
code for button is:
<Button
android:id="@+id/applyfilter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#00dec6"
android:background="@drawable/buttonshape"
android:text="APPLY" />
code for buttonshape.xml file
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="@color/navcolor"
android:endColor="@color/navcolor"
android:angle="270" />
<corners android:radius="20dp"/>
<stroke android:color="#00dec5"
android:width="5px"/>
</shape>
I have used the custom drawable file to add a border around the button, but the border is not getting applied on button. Can somebody help me ?
Upvotes: 1
Views: 143
Reputation: 31
You should try with this I can see like this:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="20dp" />
<stroke android:width="1dp" android:color="#00dec5" />
<gradient android:angle="270" android:endColor="@color/purple_500" android:startColor="@color/purple_500" />
</shape>
</item>
</selector>
Thanks!
Upvotes: 1