I am attempting to create buttons with text and a drawableTop. I want the drawableTop to be the regular size of the stored image since I have different sizes for different screen sizes. Setting height and width to match_parent seems to be based on the text, and setting them to dip values changes the size of the button, but not the image. I tried scaleX and scaleY, but that changes the size of the text as well, which I don’t want.
I am using the following, but the image appears much smaller than what it is saved as
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label"
android:drawableTop="@drawable/my_image" />
Is there anyway of creating a button with an image that automatically sets to it’s full size?
You can use a normal ImageView and set an onClickListener or XML onClick property for it.
If you want different states (e.g. pressed and unpressed) for it you can use a drawable defined in xml to set those.