Reputation: 5027
Now the button is round corner and filled with solid green when not pressed, and become solid blue with round corner when pressed. Codings are as follows:
I would like to ask how could the following be modified if I want
<Button
android:id="@+id/buttonC"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_span="4"
android:background="@drawable/story_btn"
android:onClick="buttonC_click"
android:padding="2dp"
android:text="abc"
android:textSize="20dp" />
<item android:state_pressed="true" >
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="5dp" android:color="@color/red" />
<solid android:color="@color/blue"/>
<padding android:left="5dp" android:top="2dp"
android:right="5dp" android:bottom="2dp" />
<corners android:radius="15dp" />
</shape>
</item>
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="2dp" android:color="@color/black" />
<solid android:color="@color/green"/>
<padding android:left="5dp" android:top="2dp"
android:right="5dp" android:bottom="2dp" />
<corners android:radius="15dp" />
</shape>
</item>
Upvotes: 2
Views: 2984
Reputation: 10622
You can place rounded color image itself, you no need to create round color. Then you can apply style for state:pressed
and state:selected
place the image you want, defaultly you have another image in item tag
Upvotes: 0
Reputation: 468
Upvotes: 2