首页 > 移动平台 > 详细

Android中的AlertDialog遇到的错误

时间:2017-09-19 21:50:11      阅读:289      评论:0      收藏:0      [点我收藏+]
public void showAddIPCDialog() {
Log.i("ssssssssss","wwwwwwwwww");
LayoutInflater inflater = this.getActivity().getLayoutInflater();
Log.i("ssssssssssinflater",inflater+"");
//错误
// final View layout = inflater.inflate(R.layout.addipc, (ViewGroup) findViewById(R.id.addipc_dialog));//添加布局

//正确

final View layout = inflater.inflate(R.layout.addipc, null);//添加布局

Log.i("sssssssssslayout",layout+"");
EditText etName = (EditText) layout.findViewById(R.id.et_camera_name);
EditText edit = (EditText) layout.findViewById(R.id.sn);
EditText editps = (EditText) layout.findViewById(R.id.password);

new AlertDialog.Builder(this.getActivity()).setTitle("添加监控摄像头").setView(layout)
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {

}
}).setNegativeButton("取消", null).show();
}

//总结:复制需谨慎

Android中的AlertDialog遇到的错误

原文:http://www.cnblogs.com/changyiqiang/p/7554201.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!