Question

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...);
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top