Tuesday, April 9, 2013

[android help] Set the side of an image when using android:drawable____ in a button


If you want to define the accuracy size of the drawable, You should use Java code instead of android:drawableLeft



Drawable dw = getResources().getDrawable(R.drawable.ic);
dw.setBounds(0, 0, 100, 100); // set the size of the drawable to 100*100

button.setCompoundDrawables(dw, null, null, null);


because of



android:drawableLeft // equals with setCompoundDrawablesWithIntrinsicBounds


and



android:drawablePadding // this used to control the padding between the text and drawable


.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...