Roylee Roylee - 3 months ago 8
Android Question

How to add image(left) and text on button

How to add image(left) and text on button?




For illustration:

enter image description here

Answer

use android:drawableLeft="@drawable/image" in your layout xml

you can also do this from code

Drawable icon= getContext().getResources().getDrawable( R.drawable.image);
button.setCompoundDrawablesWithIntrinsicBounds( icon, null, null, null );
Comments