さまざまなボタンとテキストビューを備えたAndroidアプリがあります。ボタン、テキストビュー、およびエディットテキストフィールドは、dpの測定を使用して画面上で間隔を空けて配置されます。したがって、たとえば、ボタンには次のようになります。'左からのマージン10dp'
問題は高密度電話の場合です。高密度画面用の新しいレイアウトを作成し、layout-largeまたはlayout-sw600-sw720のいずれかに名前を付けました(問題はGalaxy s3にあるため)。
ただし、電話は引き続き、密度画面480x800に適した通常のレイアウトファイルを呼び出します。
s3がmormalレイアウトファイルを呼び出すことを読みました。したがって、通常のファイルのxmlを高密度のxmlに変更した場合、低密度のレイアウトxmlをどのように処理すればよいですか?どのファイル名を呼び出す必要がありますか?電話はこのファイルまたは通常のファイルを再度呼び出しますか?
XMLレイアウトの抽出:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/duroodscreen"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp" >
<Button
android:id="@+id/dmute"
android:layout_width="48dp"
android:layout_height="33dp"
android:layout_alignParentLeft="true"
android:background="@drawable/soundon" />
<Button
android:id="@+id/dreset"
style="?android:attr/buttonStyleSmall"
android:layout_width="48dp"
android:layout_height="33dp"
android:layout_alignParentRight="true"
android:background="@drawable/customresetbutton" />
<TextView
android:id="@+id/dcount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/dmute"
android:layout_marginLeft="25dp"
android:layout_marginTop="36dp"
android:gravity="center"
android:singleLine="true"
android:text="Numbers"
android:textSize="25sp" />
マニフェストでの参照:
<supports-screens
android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />