android - How to stretch ImageButton without the image getting blurred? -
i create new imagebutton
via "resource chooser" , end code:
<imagebutton android:id="@+id/imagebutton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignleft="@+id/textview1" android:layout_below="@+id/textview1" android:layout_marginleft="14dp" android:layout_margintop="94dp" android:src="@drawable/mybutton" />
now, want make button way bigger, following changes:
<imagebutton android:id="@+id/imagebutton1" android:layout_width="120dp" android:layout_height="120dp" android:layout_alignleft="@+id/textview1" android:layout_below="@+id/textview1" android:layout_marginleft="14dp" android:layout_margintop="94dp" android:src="@drawable/aries" />
i change android:src="@drawable/mybutton"
android:background="@drawable/mybutton"
rid of grey button around image , stretch image instead.
problem:
my problem when stretching out image still uses file drawable-mdpi
(as should), end stretched low resolution image. if change image drawable-mdpi
folder high resolution 1 looks great, pretty sure not best solution out there have put image bigger resolution in each folder.
sound need nine-patch drawable.
a ninepatch png image in can define stretchable regions android scales when content within view exceeds normal image bounds. [...] when view grows accomodate content, nine-patch image scaled match size of view.
Comments
Post a Comment