I can find many rounded-rectangle button but it is not working to me.
What do I miss?
It is layout.xml
:
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#ebf1ff"
android:orientation="vertical">
<LinearLayout
style="@style/wrapperWidthWeightSumOne"
android:paddingTop="50dp">
<Button
android:id="@+id/btnTypeAll"
style="@style/ConsentTypeBtn"
android:layout_width="0dp"
android:layout_weight="0.85"
android:text="All"/>
</LinearLayout>
(...)
</LinearLayout>
This is button's style:
<style name="ConsentTypeBtn">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:onClick">onClick</item>
<item name="android:background">@drawable/selector_btn_consent_all</item>
<item name="android:layout_marginBottom">2dp</item>
<item name="android:singleLine">true</item>
<item name="android:layout_gravity">center</item>
<item name="android:textColor">#fff</item>
</style>
...and this is selector_btn_consent_all.xml
:
<?xml version="1.0" encoding="utf-8"?>
<selector http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/consent_type_on">
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<stroke android:width="2dp" android:color="#1F3259"/>
</shape>
</item>
<item android:state_pressed="true" android:drawable="@drawable/consent_type_on"></item>
<item android:drawable="@drawable/consent_type_off"></item>