Android Dialog全屏显示

 
  

获取屏幕宽高,设置到Dialog

 
  
Dialog dialog = new Dialog(this, R.style.Dialog);
dialog.show();
LayoutInflater inflater = LayoutInflater.from(this);
View viewDialog = inflater.inflate(R.layout.adapter_list, null);
Display display = this.getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
ViewGroup.LayoutParams layoutParams = new  ViewGroup.LayoutParams(width, height);
dialog.setContentView(viewDialog, layoutParams);


你可能感兴趣的:(自定义控件)