没什么新意 就是自己记录下怎么构建
自定义布局仿原生
LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
finalDialog dialog=newDialog(this,R.style.Dialog);
View layout=inflater.inflate(R.layout.dialog_account_logout,null);
dialog.addContentView(layout,newViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.L ayoutParams.WRAP_CONTENT));
dialog.setCancelable(false);
dialog.setContentView(layout);
TextView title=(TextView)layout.findViewById(R.id.dialog_logout_title);
title.setText("确定要退出登录吗");
Button dialogLogoutPositiveButton=(Button)layout.findViewById(R.id.dialog_logout_positiveButton);
dialogLogoutPositiveButton.setOnClickListener(newView.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
网友评论