Roylee Roylee - 1 year ago 108
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 Source

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 );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download