//获取布局的管理对象
LayoutInflater inflater = getLayoutInflater();
//添加自定义的布局到view
View view1 = inflater.inflate(R.layout.dialog_activity, null);
//显示AlertDialog并把自定义的布局添加到AlertDialog AlertDialog dialog = new AlertDialog.Builder(this).setView(view1).show();
本文介绍如何在Android应用中使用LayoutInflater加载自定义布局,并将其应用于AlertDialog的显示。通过具体代码示例展示了创建自定义对话框的过程。
//显示AlertDialog并把自定义的布局添加到AlertDialog AlertDialog dialog = new AlertDialog.Builder(this).setView(view1).show();
5501

被折叠的 条评论
为什么被折叠?