我有一個警告對話框(圖像和文本每行中),但它太寬。我怎樣才能改變對話框的寬度?Android的警告對話框更改寬度
我的代碼:
ListAdapter adapter = new AnimalAdapter(this, _options);
final AlertDialog.Builder ad = new AlertDialog.Builder(this);
ad.setTitle("Options");
ad.setSingleChoiceItems(adapter, -1, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String selectedVal = _options[which].getVal();
options_selected_item = selectedVal;
dialog.dismiss();
}
});
ad.show();
我曾嘗試之前和之後ad.show();
加入ad.getWindow().setLayout(600, 400);
但我得到
The method getWindow() is undefined for the type AlertDialog.Builder.
ad.create();怎麼了 ? – 2012-03-05 18:28:42
沒什麼。該對話框不出現 – erdomester 2012-03-05 18:57:44