我有一个选项菜单,上面的项目显示一个对话框。由于某种原因,它以非常小的宽度显示。我想知道为什么。下面是对话框代码和 optionsuserdetails xml。我知道我错过了一些非常愚蠢的东西。抱歉,代码很长,但问题可能出在此选项菜单显示的任何地方。
case God.USER_DETAILS:
userDetails = new Dialog(this);
userDetails.requestWindowFeature(Window.FEATURE_NO_TITLE);
userDetails.setContentView(R.layout.optionsuserdetails);
userDetails.setCancelable(true);
userName = (TextView) userDetails.findViewById(R.id.userName);
userName.setText(God.appConfiguration.getString(God.nameKey, "-"));
drivingLicense = (TextView) userDetails.findViewById(R.id.drivingLicense);
drivingLicense.setText(God.appConfiguration.getString(God.drivingLicenseKey, "-"));
vehicleNumber = (TextView) userDetails.findViewById(R.id.vehicleNumber);
vehicleNumber.setText(God.appConfiguration.getString(God.vehicleRegistrationNumberKey,
"-"));
phoneNumber = (TextView) userDetails.findViewById(R.id.phoneNumber);
phoneNumber.setText(God.appConfiguration.getString(God.phoneNumberKey, "-"));
userDetails.show();
break;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/roundcornersgreyback"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Personal Details"
android:textColor="#990000"
android:textSize="20sp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="These are the details you have provided during registration."
android:textColor="#666666"
android:textSize="10sp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#cccccc" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Name"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/userName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is the name you provided during registration."
android:textColor="#222222"
android:textSize="12sp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Driving License Number"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/drivingLicense"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is the driving license number you provided during registration."
android:textColor="#222222"
android:textSize="12sp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="License Plate (Vehicle)"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/vehicleNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is the license plate number of the vehicle you are driving."
android:textColor="#222222"
android:textSize="12sp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Phone Number"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/phoneNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is the phone number you provided during registration."
android:textColor="#222222"
android:textSize="12sp" />
</LinearLayout>
编辑:可绘制
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#eeeeee" />
<stroke
android:width="2dp"
android:color="#cccccc" />
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
<corners
android:bottomLeftRadius="7dp"
android:bottomRightRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp" />
</shape>