最好的方法是自定义对话框。因为这将有助于创建所有这些背景颜色和效果。我确定您发布的链接也正在使用自定义对话框,
干杯
链接可能会有所帮助:
[1]
http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog
[2] http://androidideasblog.blogspot.com/2010/02/creating-custom-dialog-in-
android.html
///在您的代码实现中,只需在创建对话框时添加此代码即可。在将所有TextView安排在布局中并将该布局ID添加到下面的代码后,祝您好运
//Dialog box creatorprivate Dialog constructYourDialog(){ //Preparing views LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.***your_xml_name***, (ViewGroup) findViewById(R.id.***Yout view id***)); //Building dialog alertDialog.Builder builder = new alertDialog.Builder(this); builder.setView(layout); builder.setPositiveButton("Show Videos", new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Log.i("","Show Video Click"); dialog.dismiss(); }); builder.setNegativeButton("E-Mail", new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) {Log.i("","E-mail Click");dialog.dismiss(); } }); builder.setNeutralButton("Show Map", new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Log.i("","Show Map Click"); dialog.dismiss(); } }); alertDialog alert = builder.create(); return alert;}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)