2x2グリッドに4つのImageButtonがある画面があります(TableLayoutを使用)。
さまざまな画面サイズすべてをサポートする必要があります。そこで、4つのレイアウトフォルダー(小、中、大、特大)を作成しました。
ImageButtonの位置は問題なく機能しました。ただし、大画面と特大画面では、ImageButtonのサイズが小さすぎます。
mdpiと他のフォルダー間のx0.75、x1、x1.5、およびx2の関係を使用して、異なる密度の4つのフォルダー(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>