Android dialog弾枠をクリックして空白が消えないようにする

691 ワード

public static Dialog creatDialog(final Context context, String tip){
  Dialog dialog = new Dialog(context, R.style.appDialog); 
  dialog.setContentView(R.layout.common_wdailog); 
  dialog.setCanceledOnTouchOutside(false);//       Dialog   
  Window window = dialog.getWindow();
  
  
  WindowManager.LayoutParams lp = window.getAttributes(); 
  int width = UiHelper.getScreenWidth(context); 
  lp.width = (int)(0.6 * width); 
  
  TextView titleTxtv = (TextView) dialog.findViewById(R.id.common_wdialog_message);
  if (tip == null || tip.length() == 0){//    
   titleTxtv.setText("   ..."); 
  }else{
   titleTxtv.setText(tip); 
  }
  
  
  return dialog;
 }