我是div元素
public void onShowPromptDialog1(View v){
//inflate需要显示到Dialog里的View对象
LayoutInflater li = LayoutInflater.from(this);
View view = li.inflate(R.layout.addfriend, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("输入群名称");
builder.setIcon(R.drawable.icon);
//之前inflate的View 放到dialog中
builder.setView(view);
builder.setPositiveButton("确定", this);
builder.setNegativeButton("取消", this);
builder.create().show();
}
}
参考资料
CSDN.CSDN[引用时间2018-1-6]