3
I have a button that has round borders and when it is selected changes color. A certain text is associated with that button. It turns out I want the button to have an image plus the text and I can’t do it.
<Button
android:text="Texto"
android:background="@drawable/roundshape4_selector"
android:layout_width="85dp"
android:layout_height="85dp"
android:gravity="center"
android:id="@+id/texto"
android:textStyle="bold"
android:onClick="onClick"
android:textColor="#B56EB6"
android:textSize="12dp"/>
Here is the code of roundshape4_selector
used for when the button is pressed to change color
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/roundshape4_pressed" />
<item android:drawable="@drawable/roundshape4" />
</selector>
roundshape4_pressed
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/pink"/>
<corners android:radius="10dip" />
</shape>
This is where I’m trying to tag the image <img scr="@drawable/imagem48"></img>
but only the text appears.
roundshape4
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<img scr="@drawable/imagem48"></img>
<corners android:radius="10dip" />
<stroke android:color="@color/pink"
android:width="6dip"></stroke>
<solid android:color="@color/white"></solid>
</shape>
How can I make the button to show me the image and text at the same time?