Android 为什么我的警报对话框没有显示所有内容

Android 为什么我的警报对话框没有显示所有内容,android,android-layout,Android,Android Layout,我正在尝试使用布局自定义警报对话框。问题在于,“警报”对话框的大小很小,并且大多数布局都是分段的或单词重叠。这不是屏幕问题,因为对话框非常小,似乎无法扩展到涵盖所有内容。你认为这是为什么 我使用以下布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width

我正在尝试使用布局自定义警报对话框。问题在于,“警报”对话框的大小很小,并且大多数布局都是分段的或单词重叠。这不是屏幕问题,因为对话框非常小,似乎无法扩展到涵盖所有内容。你认为这是为什么

我使用以下布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/linearLayout1"
        android:layout_alignParentLeft="true"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/tvNa"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"/>

        <EditText
            android:id="@+id/etNa"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/tvQ"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"/>

        <EditText
            android:id="@+id/etQ"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout3"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/linearLayout1"
        android:layout_centerVertical="true"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/tvP"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.5" />

        <EditText
            android:id="@+id/etP"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:inputType="numberDecimal" />

    </LinearLayout>

</RelativeLayout>

对话框对象有一个设置的最大大小,您没有重写它。您可以将布局添加到滚动视图中。除此之外,您必须遵循对话框的继承,直到找到设置最大对话框大小的位置并覆盖该对话框。GrepCode是查看SDK源代码的好地方。

alert.setContentViewR.layout.add\u对话框它不存在。这是警报对话框,不是对话框。它有setView,我在上面使用过它
AlertDialog.Builder alert = new AlertDialog.Builder(this);
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

View layout = inflater.inflate(R.layout.add_dialog, null);
alert.setView(layout);
alert.setTitle("New one");
alert.setPositiveButton("Ok",new DialogInterface.OnClickListener() {
@Override
    public void onClick(DialogInterface dialog, int whichButton) {


    }
});
alert.setNegativeButton("Cancel",new DialogInterface.OnClickListener() {
@Override
    public void onClick(DialogInterface dialog, int whichButton) {

    }
});
alert.show();