我有一個2×2網格中的4個ImageButton(使用TableLayout)的屏幕。在不同的屏幕布局上的ImageButton大小
我需要支持所有不同的屏幕尺寸。所以我創建了4個佈局文件夾(小,中,大和超大)。
它工作正常的ImageButton的位置。但在大屏幕和超大屏幕上,ImageButton的尺寸太小。
我試圖解決這個問題,使用mdpi之間的x0.75,x1,x1.5和x2關係,使用4個文件夾實現diferents密度(drawable-ldpi,drawable-mdpi,drawable-hdpi和drawable-xhdpi)和其他文件夾。
但我認爲這是行不通的或不是解決這個問題的正確方法。
這是正確的解決方法?
我擔心小屏幕,但與高密度。或低密度的中等屏幕。在這些情況下,可能沒有工作,對吧?
我的另一個想法是強制每個尺寸文件夾的每個佈局上ImageButton的大小(以傾斜度測量)。這是一個更好的解決方法?
我真的失去了這個。我想要應用最好的/正確的解決方案。
有人可以幫我嗎?
感謝和抱歉,我英文不好
更新:
這是佈局:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center_horizontal">
<TableRow
android:gravity="center"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_marginTop="60dip" >
<ImageButton
android:id="@+id/newCard_button"
android:layout_margin="10dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/selector_new_card_button"/>
<ImageButton
android:id="@+id/showLastTicket_button"
android:layout_margin="10dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/selector_show_last_ticket_button"/>
</TableRow>
<TableRow
android:gravity="center"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<ImageButton
android:id="@+id/cancelLastTransaction_button"
android:layout_margin="10dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/selector_anulla_button"/>
<ImageButton
android:id="@+id/searchCustomer_button"
android:layout_margin="10dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/selector_search_customer_button"/>
</TableRow>
</TableLayout>
你可以發佈你的XML佈局代碼? – iTurki 2012-08-09 18:40:19