Kangee
Kangee

Reputation: 53

Android Button drawableLeft - how to hardcode it (no xml)

How can I add a "drawable left" icon to a button object?

I mean something like this:

Button button = new Button();
button.setDrawableLeft(R.drawable...);

Upvotes: 5

Views: 2481

Answers (1)

Peter Knego
Peter Knego

Reputation: 80330

Use Button.setCompoundDrawablesWithIntrinsicBounds(..) which relates to android:drawableLeft attribute.

Upvotes: 6

Related Questions