Android background + text + icon for a button Android background + text + icon for a button xml xml

Android background + text + icon for a button


Maybe you should use RelativeLayout with rounded corners, than put TextView and ImageView inside of it.


Try this:

    Button button = (Button) findViewById(R.id.button1);    Spannable buttonLabel = new SpannableString(" Settings");    buttonLabel.setSpan(new ImageSpan(getApplicationContext(), R.drawable.settings_selected,              ImageSpan.ALIGN_BOTTOM), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);    button.setText(buttonLabel);


Try this: Follow this : http://porcupineprogrammer.blogspot.in/2013/03/android-ui-struggles-making-button-with.html

<FrameLayout    style="?android:attr/buttonStyle"    android:layout_width="match_parent"    android:layout_height="wrap_content" >    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_gravity="center"        android:drawableLeft="@android:drawable/ic_delete"        android:gravity="center"        android:text="Button Challenge" /></FrameLayout>