沒什么新意 就是自己記錄下怎么構(gòu)建
自定義布局仿原生
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();