0
我的點擊操作欄圖標我想要顯示對話框。 (即)我正在使用自定義對話框。 對話框我創建xml佈局。 我試着在下面給出的程序...當我點擊操作欄圖標時,我想要顯示自定義對話框(例如)我們的對話框xml我的對話框
其實我想在點擊圖標的時候顯示自定義對話框(自定義)。
switch (item.getItemId()) {
case R.id.icon:
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.dailog);
dialog.setTitle("Custom Dialog Example");
Button dialogButtonCancel = (Button) dialog.findViewById(R.id.cancel);
Button dialogButtonOk = (Button) dialog.findViewById(R.id.ok);
// Click cancel to dismiss android custom dialog box
dialogButtonCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
}
return true;
}
當運行應用程序有沒有輸出
嗨,henrique:我試過}); dialog.show(); 休息; } return true; } –
但是沒有進展 –
返回外面的開關是不是?所以它應該沒關係,我誤解它是在第一次。 –