android - Fitting imageButtons into different screen sizes -


i new android programming. have problem scaling imagebuttons different screen-resolutions. made different image sizes based on dpi , put them hdpi(120px*72px,160dpi), mdpi(80px*48px,160dpi) , xhdpi(160px*96px,160dpi) on screen-resolutions 1280x720 there little bit of space on right side. tried things like:

android:scaletype="fitxy" android:scaletype="centerinside" android:adjustviewbounds="true" 

but nothing worked. also, not quite sure these do. said, new android.

https://www.dropbox.com/sh/dmtcn4lxyxxh5wt/vpq9pbmosl

<imagebutton     android:id="@+id/imagebuttonsearch"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparentbottom="true"     android:layout_torightof="@+id/imagebuttonshare"     android:background="@null"     android:scaletype="centerinside"     android:src="@drawable/selector_search"     android:adjustviewbounds="true" /> 

thanks in advance

you should use linearlayout , set imagebutton's layout_weight attr 0.25 linearlayout must in parent bottom.

like this;

<linearlayout      android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_alignparentbottom="true"     android:orientation="horizontal">      <imagebutton          android:layout_width="0dip"         android:layout_height="wrap_content"         android:layout_weight="0.25"         android:src="@drawable/ic_launcher"/>      <imagebutton          android:layout_width="0dip"         android:layout_height="wrap_content"         android:layout_weight="0.25"         android:src="@drawable/ic_launcher"/>      <imagebutton          android:layout_width="0dip"         android:layout_height="wrap_content"         android:layout_weight="0.25"         android:src="@drawable/ic_launcher"/>      <imagebutton          android:layout_width="0dip"         android:layout_height="wrap_content"         android:layout_weight="0.25"         android:src="@drawable/ic_launcher"/>  </linearlayout> 


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -