I'm trying to padd my button background image of my main menu (I'm using a selector for the different states), doing it on this way (buttoninicio_custom.xml):
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/botoninicial_pressed"
android:state_pressed="true">
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</item>
<item android:drawable="@drawable/botoninicial_pressed"
android:state_focused="true">
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</item>
<item android:drawable="@drawable/botoninicial">
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</item>
</selector>
..but the padding has no effect. What I should do to solve this problem??
I already used "bitmap" tag inside each "item" tag with the padding inside, but it's still doing anything!!!
My main button looks this way:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<Button
android:id="@+id/button2"
android:layout_width="180dp"
android:layout_height="50dp"
android:layout_marginBottom="15dp"
android:textSize="16sp"
android:textColor="#FFFFFF"
android:background="@drawable/buttoninicio_custom"
android:text="@string/idmMENU2" />
</LinearLayout>
"Because if I set android:padding inside the "button" tag, it pads me the text not the background image... The problem it's that when I pressed the main button: My image background change correctly but the new image appear cut."
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…