i am trying to add a click-effect on my xml-created button. So far i got the clickeffect running, but i cant manage to supply the click-effect the same rounded corners i have on the unclicked button; it looks horrible this way. In my gradient.xml
I am supplying the same imagelayout with the rounded corners, but it seems to ignore this setting.
Can someone point me in the right direction?
< --- >
my box with clickeffect.xml: (box_with_click_effect.xml)
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true"
android:state_pressed="false"
android:drawable="@drawable/rounded_box" />
<item android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/gradient" />
<item android:state_focused="false"
android:state_pressed="true"
android:drawable="@drawable/gradient" />
<item android:drawable="@drawable/rounded_box" />
</selector>
my button-drawable-xml: (rounded_box.xml)
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/my_orange"/>
<corners android:radius="15px"/>
<padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" />
</shape>
my gradient.xml for the clicked-state: (gradient.xml)
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<!-- THIS DOESN'T WORK: <bitmap android:src="@drawable/rounded_box"/>
SO I TRY THIS: -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/cocus_orange"/>
<corners android:radius="15px"/>
<padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" />
</shape>
</item>
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:angle="90"
android:startColor="#880f0f10"
android:centerColor="#880d0d0f"
android:endColor="#885d5d5e"/>
</shape>
</item>
</layer-list>