如何在我的android項目中實現對話框?如何實現Android對話框?
回答
使用此代碼在任何你想顯示對話框..
AlertDialog.Builder builder =new AlertDialog.Builder(Dialogs.this);
builder.setIcon(R.drawable.save1);
builder.setTitle("Save Your Work");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// do something.......
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// do something.......
}
});
AlertDialog alert = builder.create();
alert.show();
謝謝你這麼多........... :) –
你可以下載圖像添加到對話框中.. – Mohit
public void onClick(View v){ DB.open(); 光標c = DB.getContact(「1」);如果(c.moveToFirst()){0} { }則顯示(c); } while(c.moveToNext()); } DB.close(); String checkPass = pass.getText()。toString();如果(checkPass.equals(getpass)){startActivity(new Intent(Welcome.this,Main.class)); Toast.makeText(getBaseContext(),「Wrong PassWord」,Toast.LENGTH_LONG).show();其他{ } else { Toast.makeText } } –
您是在尋找簡單的AlertDialog或對話框?
例AlertDialog:
AlertDialog.Builder alertDialog = new AlertDialog.Builder(Borc.this);
// Setting Dialog Title
alertDialog.setTitle("Eraser");
// Setting Dialog Message
alertDialog.setMessage("Are you sure?");
// Setting Icon to Dialog
alertDialog.setIcon(R.drawable.remove);
// Setting Positive "Yes" Button
alertDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dataBase.borclar.delete(String.valueOf(tableHelper.getSelectedRowId()));
}
});
// Setting Negative "NO" Button
alertDialog.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
// Showing Alert Message
alertDialog.show();
我想開始與Android對話的最好方式是閱讀文檔:Android Dialog Documentation。它們描述了各種類型的對話框以及如何在應用程序中實現它們。
如果您遇到特定問題,請告訴我們您的代碼並提出正確的問題。
- 1. 如何在Jquery UI對話框中實現「確認」對話框?
- 2. 如何實現模態對話框?
- 3. 如何在XNA中實現對話框
- 4. android ui - 如何實現一系列對話框
- 5. 如何在對話框中實現onWindowFocusChange()方法(Android)
- 6. Android - 如何實現後臺線程的登錄對話框?
- 7. Android - 如何實現列表框作爲模式對話框/彈出框
- 8. 如何在非模態對話框上正確實現模態對話框?
- 9. Android:如何將對象從對話框傳遞到對話框
- 10. Android - 關閉對話框片段後出現小對話框
- 11. Android:自定義提醒對話框出現在DEFULT對話框
- 12. 從資源實現對話框
- 13. .NET登錄對話框實現
- 14. WinForms:實現設置對話框?
- 15. 對話框和控件實現
- 16. 文件瀏覽器對話框實現
- 17. 在JavaScript中實現save.As()對話框csv
- 18. 用JQuery UI對話框實現Jcrop
- 19. 如何在Android中顯示對話框中的對話框?
- 20. android對話框:關閉活動後如何返回對話框?
- 21. Android對話框
- 22. Android對話框
- 23. 如何在Android應用程序中實現來自Facebook的Feed對話框?
- 24. 無法在Android中實現自定義對話框的代碼
- 25. 自定義文本對話框實現的OnClick聽衆的Android
- 26. 有對話框的Android對話框
- 27. 進度對話框不會出現 - Android
- 28. Android對話框的實際大小
- 29. 如何實現像對話框但使用jgrowl返回確認?
- 30. 如何使用Angular 4 Material對話框實現路由
你有什麼問題?你可以更多地指定它嗎? – edisonthk