Reputation: 939
I want to use an image as a Button for an Android App, so I'm using an ImageButton. I want it to be pretty big so I understood the best way to do it is to configure the background of the image as the image I want. I'm setting the layout width and height to 250dip but I'm getting a pretty low resolution. The image is of 1000X1000 px so there is no real reason it would show pixelated as it is showing... Is there any way to resolve this? To set the image button to be pretty big and using a better quality image (from the drawable-xhdpi for example)? Thanks!
EDIT:
This is the code for the imageView:
<ImageView
android:id="@+id/activateButtonImage"
android:layout_width="250dip"
android:layout_height="250dip"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:contentDescription="@null"
android:minHeight="250dip"
android:minWidth="250dip"
android:scaleType="centerInside"
android:background="@drawable/deactivateicon"
/>
ScreenShot:
Upvotes: 0
Views: 313
Reputation: 3104
You can also use an ImageView with onClick
to act as a button. If the image is a resource, reference it in the android:src=@drawable/image
parameter and scale it as suggested by Gabe's answer.
Upvotes: 1
Reputation: 1249
Your image is plenty big. Try adding:
android:scaleType="centerInside"
to your ImageButton
in the xml layout file.
Upvotes: 1