Я создаю пользовательское диалоговое окно в моем приложении, и оно прекрасно выглядит в редакторе макетов, но не подходит по размеру для устройства.Вот макет для диалога:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/dialog_border"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:padding="10dp"
android:src="@drawable/wifi" />
<TextView
android:layout_height="wrap_content"
android:id="@+id/heading"
android:layout_below="@+id/image"
android:layout_width="wrap_content"
android:layout_margin="10dp"
android:layout_alignLeft="@+id/cancel_button"
android:layout_alignRight="@+id/continue_button"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/lost_connection"
android:layout_centerHorizontal="true" />
<TextView
android:layout_height="wrap_content"
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_below="@+id/heading"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_centerHorizontal="true"
android:layout_alignLeft="@+id/cancel_button"
android:layout_alignRight="@+id/continue_button"
android:gravity="center"
android:layout_margin="10dp"
android:text="@string/try_again" />
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toRightOf="@+id/cancel_button"
android:layout_below="@+id/description"
android:layout_centerHorizontal="true"
android:id="@+id/dismiss_button"
android:text="@string/dismiss" />
</RelativeLayout>
Вот как это выглядит в редакторе раскладок:
Но это то, как это выглядит на устройстве:
У него есть та странная часть дополнительного пространства сверху и справа, и кнопка сжимается вертикально.