1
我知道这个问题的答案必须围绕地方,但我一直没能找到它......的Android AlertDialog与自定义宽度
我有一个自定义AlertDialog,不管我怎样设置参数在XML文件和/或Java代码中,对话框始终以全屏宽度显示。
现在,我的布局文件是这样的:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/color_picker_dlg_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TableRow>
[...]
</TableRow>
</TableLayout>
,我在代码中创建的AlertDialog这样的:
layout = inflater.inflate(R.layout.color_picker_dlg, (ViewGroup) findViewById(R.id.color_picker_dlg_root));
builder = new AlertDialog.Builder(this);
builder.setView(layout);
[...]
dialog = builder.create();
...并在对话框依然占据了所有的屏幕宽度。
我能做些什么来包装其内容?
在此先感谢。