最近までNexus 7(7.27インチ、800x1280:tvdpi)のエミュレーターでテストされていたタブレット用のアプリを開発しています。samsung galaxy note 2 (5.6'',720x1280:xhdpi) に似た別のエミュレーターでアプリをテストすることを決定するまでは、すべて問題ありませんでした。
たとえば、私が使用しているこのカスタム アラート ダイアログを見てください。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_layout_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:background="@color/light_gray">
<Button
android:id="@+id/facebook_login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"/>
<TextView
android:id="@+id/or_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:textSize="20sp"
android:textColor="@color/black"
android:layout_below="@id/facebook_login_button"/>
<TextView
android:id="@+id/sign_in_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:textSize="20sp"
android:textColor="@color/gray"
android:layout_below="@id/or_text"/>
<EditText
android:id="@+id/login_email"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_below="@id/sign_in_text"
android:hint="@string/email_login"
android:inputType="textEmailAddress"/>
<EditText
android:id="@+id/login_password"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_below="@id/login_email"
android:hint="@string/pass_login"
android:inputType="textPassword"/>
<TextView
android:id="@+id/case_sensitive_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:textSize="18sp"
android:textColor="@color/gray"
android:layout_below="@id/login_password"/>
<CheckBox
android:id="@+id/remember_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:layout_below="@id/case_sensitive_text"/>
<Button
android:id="@+id/sign_in_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/remember_login"
android:layout_marginLeft="300dp"/>
<TextView
android:id="@+id/forget_password_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:layout_marginLeft="180dp"
android:textSize="18sp"
android:textColor="@color/black"
android:layout_below="@id/sign_in_button"/>
<View
android:id="@+id/horizontal_line"
android:layout_width="360dp"
android:layout_marginTop="20dp"
android:layout_height="1dp"
android:background="@android:color/darker_gray"
android:layout_below="@id/forget_password_text"/>
<TextView
android:id="@+id/new_app_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="18sp"
android:textColor="@color/black"
android:layout_below="@id/horizontal_line"/>
<TextView
android:id="@+id/create_account_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="18sp"
android:textColor="@color/gray"
android:layout_below="@id/new_app_text"/>
<Button
android:id="@+id/create_account_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/create_account_text"
android:layout_marginLeft="250dp"
android:layout_marginTop="10dp"/>
<TextView
android:id="@+id/terms_conditions_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="12sp"
android:textColor="@color/gray"
android:layout_below="@id/create_account_button"/>
<TextView
android:id="@+id/vertical_rule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="12sp"
android:textColor="@color/gray"
android:layout_below="@id/create_account_button"
android:layout_toRightOf="@id/terms_conditions_text"/>
<TextView
android:id="@+id/privacy_policy_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="12sp"
android:textColor="@color/gray"
android:layout_below="@id/create_account_button"
android:layout_toRightOf="@id/vertical_rule"/>
</RelativeLayout>
ご覧のとおり、相対レイアウトを使用しており、どこでも dp を使用し、フォント サイズには sp を使用しています。アラート ダイアログの背景に気付いた場合は、フラグメントでさえ正しく表示されていません。ここで見ることができます: http://imageshack.us/g/692/tvdpi.jpg/
なぜこれが起こっているのですか?
前もって感謝します。