在我的应用程序中,我使用相对布局进行设计。在一个活动中,我在屏幕底部有四个按钮。我的 xml 代码(景观)不适合所有设备屏幕。如图所示,按钮之间的空间更大。如何设计适合所有分辨率屏幕(横向)的布局。
布局图像是:
我的xml:
<RelativeLayout android:id="@+id/relativeLayout1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#0000FF"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout android:layout_width="fill_parent"
android:layout_gravity="bottom" android:layout_alignParentBottom="true"
android:background="@drawable/applicarion_bar" android:layout_height="wrap_content"
android:id="@+id/relativeLayout4">
<ImageButton android:id="@+id/homeimageButton2"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/festival_btn" />
<ImageButton android:layout_height="wrap_content"
android:layout_toRightOf="@+id/homeimageButton2"
android:layout_marginLeft="60dp"
android:layout_width="wrap_content" android:background="@drawable/search_btn"
android:id="@+id/homeimageButton3"></ImageButton>
<TextView android:id="@+id/homecalendar4" android:text="MAR 20"
android:layout_toRightOf="@+id/homeimageButton3"
android:gravity="center"
android:textSize="10dp"
android:layout_marginLeft="60dp"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/calendar_btn" />
<ImageButton android:id="@+id/homeimageButton5"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/favorite_btn" />
</RelativeLayout>