在我的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