android Dialog重绘

String title = "";
		if(itemInfo!=null)
			title = "\n\""+itemInfo.itemSSID+"\"  ";
		else
			title = "\n\""+ssid+"\"  ";
		title += getResources().getString(R.string.network_wifi_password_error_info) ;
		View password_error = AppData.inflater.inflate(R.layout.wifi_password_error, null);   
		TextView password_title = (TextView)password_error.findViewById(R.id.wifi_password_info_show);
		password_title.setText(title);
    
		final AlertDialog alertDialog = new AlertDialog.Builder(WirelessNetworkActivity.this).create();   
		alertDialog.setView(password_error);
		Window window = alertDialog.getWindow();      
		WindowManager.LayoutParams lp = window.getAttributes();   
		alertDialog.show();
        lp.width = 920;
        lp.height = 300;
		lp.alpha = 0.9f;      
		window.setAttributes(lp);     
		password_error.findViewById(R.id.wifi_password_cancel).setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				alertDialog.dismiss();
			}
		});

  

posted @ 2016-09-09 11:42  一样菜  阅读(1373)  评论(0编辑  收藏  举报