I'm trying to set a left icon on a button with:
setCompoundDrawablesWithIntrinsicBounds(R.drawable.foo, 0, 0, 0); but the icon is placed flush up against the left edge of my button, and the text string. Is there a way to specify some left/right padding on the supplied icon so that it isn't right up against the edges?
Thanks
I believe what you're looking for is android:drawablePadding
Here's an example of using drawablePadding along with paddingLeft and paddingRight to position an image in a button
<Button     android:id="@+id/button"     android:layout_width="200dp"     android:layout_height="80dp"     android:drawableLeft="@drawable/ic_launcher"     android:drawablePadding="2dip"     android:paddingLeft="30dip"     android:paddingRight="26dip"     android:text="Test" /> 
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With