在我的android应用程序中,我有一个带有listview和4个按钮的RelativeLayout。在列表视图中选择任何项目将使四个隐藏的按钮可见。我遵循了http://developer.android.com/guide/practices/screens_support.html的最佳做法。它在WVGA800的仿真器和实际设备中工作正常。我正在测试不同屏幕尺寸的应用程序。看起来像QVGA(240x320),底部的按钮被砍掉。 这里是XML布局在较低分辨率屏幕上被砍掉
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/listViewrelativeLayout" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" >
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/info_tv_id" android:textSize="10sp" android:layout_marginLeft="10dip"></TextView>
<ListView android:id="@+id/listView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:choiceMode="singleChoice" android:layout_marginTop="25dip" android:layout_below="@id/info_tv_id">
</ListView>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="bottom" android:layout_alignParentBottom="true" android:id="@+id/relativekeybuttons" android:layout_below="@+id/listView1" android:visibility="gone">"
<Button android:id="@+id/setasdefault" android:text="@string/default_btn_text" android:layout_marginTop="10dip"
android:layout_height="50sp" android:layout_width="75sp">
</Button>
<Button android:id="@+id/changepassphrase" android:layout_marginTop="10dip" android:text="@string/passphrase_btn_text" android:layout_width="75sp" android:layout_height="50sp"
android:layout_toRightOf="@+id/setasdefault"></Button>
<Button android:id="@+id/rename" android:text="@string/rename_btn_text" android:layout_marginTop="10dip" android:layout_width="75sp" android:layout_height="50sp"
android:layout_toRightOf="@+id/changepassphrase"></Button>
<Button android:id="@+id/delete" android:layout_width="75sp" android:layout_marginTop="10dip" android:layout_height="50sp" android:text="@string/delete_btn_text"
android:layout_toRightOf="@+id/rename"></Button>
</RelativeLayout>
</RelativeLayout>
另外,我想列表视图占据布局固定长度。例如:至少70%的屏幕,以便列表视图的长度不依赖于列表视图中的项目。
在此先感谢
你确定他们都属于相同的广义密度** hdpi **。如果没有,你可以尝试一个新的文件夹的布局。 – Samuel