我正在尝试显示带有自定义视图的对话框。布局非常简单;基本上有两个LinearLayouts;每个布局的TextView和EditText。Android:自定义对话框尺寸错误
我使用的布局是这样的:
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:orientation="vertical"
android:layout_margin="5dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ll_element1">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Element 1"/>
android:layout_width="250dip"
android:layout_height="wrap_content"
android:lines="5"/>
android:orientation="vertical"
android:layout_margin="5dip"
android:layout_width="wrap_content"
android:layout_below="@id/ll_element1"
android:layout_height="wrap_content">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Element 2"/>
android:layout_width="250dip"
android:layout_height="wrap_content"
android:lines="5"/>
但是,如果我把它设置为视图对话框如下所示:
我的代码显示对话框是这样的:
var view = this.LayoutInflater.Inflate(Resource.Layout.Custom_Dialog, null);
var dialog = new AlertDialog.Builder(this)
.SetView(view)
.Create();
dialog.Show();
在我看来,对话框的宽度应该更小,以便布局填充对话框。 我已经试过几件事情:
使用的LinearLayout代替RelativeLayout的
设置explizit
二手对话,而不是AlertDialog
这样,我必须做的所有大小获得正确大小的对话框?
编辑 更新了图片
2012-08-23
Noffls