xml - Android button spacing layout uneven -


i have issue app button layout not evenly spaced when used on different devices.

as shown, first screenshot shows layout evenally spaced out on older, smaller screened android smartphone.

enter image description here

the second screenshot nexus 4, shows large white space under bottom button uneven.

enter image description here

i thought had set layout seems isnt.

update: how set scroll view 2 linear layouts in it.

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" >  <linearlayout     android:layout_width="match_parent"     android:layout_height="84dp"     android:orientation="horizontal" >      <imageview         android:id="@+id/imglink"         android:layout_width="78dp"         android:layout_height="wrap_content"         android:layout_gravity="center_vertical"         android:src="@drawable/appointmentmanimenuicon" />        <textview         android:id="@+id/textview1"         android:layout_width="match_parent"         android:layout_height="75dp"         android:gravity="center"         android:text="appointments"         android:textappearance="?android:attr/textappearancelarge"         android:textsize="30sp" /> </linearlayout>       <scrollview         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:fillviewport="true">      <linearlayout         android:layout_width="match_parent"         android:layout_height="200dp"         android:orientation="vertical" >      <button         android:id="@+id/btnaddappoint"         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_margin="50dp"         android:drawableleft="@drawable/appointmentmenu"         android:src="@drawable/appointmentmenu"         android:text="add appointment"         android:layout_weight="1" />      </linearlayout>         <linearlayout         android:layout_width="match_parent"         android:layout_height="200dp"         android:orientation="vertical" >     <button         android:id="@+id/btnviewappoint"         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_margin="50dp"         android:drawableleft="@drawable/appointviewicon"         android:src="@drawable/appointviewicon"         android:text="view appointments"         android:layout_weight="1" /> </linearlayout> </scrollview> </linearlayout> 

your nested linear layout buttons has fixed height of 400dp. on small device leaves smaller amount of space @ bottom on larger nexus4.

if change linear layout buttons use height value of fill_parent should place buttons evenly in space remaining in parent layout underneath header ( contacts).


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -