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();
...並在對話框依然佔據了所有的屏幕寬度。
我能做些什麼來包裝其內容?
在此先感謝。