0
這是代碼谷歌表示,用來創建自定義提醒對話(它說,創建自己的佈局,然後使用該佈局的setContentView)如何創建自定義警報diaogue
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
LayoutInflater inflater = getActivity().getLayoutInflater();
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
builder.setView(inflater.inflate(R.layout.dialog_signin, null))
// Add action buttons
.setPositiveButton(R.string.signin, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// sign in the user ...
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
LoginDialogFragment.this.getDialog().cancel();
}
});
return builder.create();
}
谷歌則表示,以在另一個類中創建此類的實例,然後使用show()方法顯示它,但是show方法需要一個片段管理器,並且片段管理器在嘗試創建它時會收到錯誤。
這裏的說明http://developer.android.com/guide/topics/ui/dialogs.html#CustomLayout
,我需要一個微調添加到啓動一個新的活動
警報對話如果有人能想出如何得到這個工作(使對話彈出)並張貼這將是巨大
我需要與微調器進行快速對話 – user2109242 2013-04-28 22:01:53