0

我想在单击按钮时打开弹出视图,但弹出窗口后面的活动应该是可见的,因为创建的弹出窗口的背景需要按需透明。

4

3 回答 3

2

你可以做如下

final Dialog nagDialog = new Dialog(MyActivity.this,android.R.style.Theme_Translucent_NoTitleBar);
                nagDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
                nagDialog.setCancelable(true);
                nagDialog.setContentView(R.layout.temp);


                nagDialog.show();

其中 temp 是您的透明布局。

于 2012-08-06T07:15:25.770 回答
1

我的弹出代码:-

LayoutInflater layoutInflater  =     (LayoutInflater)IOStatusActivity.this.getSystemService(LAYOUT_INFLATER_SERVICE)    
final View popupView = layoutInflater.inflate(R.layout.popupai, null);  

final PopupWindow popupWindowDi = new PopupWindow(popupView,  LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);  

final   TextView txtReadVal = (TextView)popupView.findViewById(R.id.lblPopUpAiReadFrmPLC);
final   EditText txtExpVal = (EditText)popupView.findViewById(R.id.txtPopUpAiExpVal);
Button btnDismiss = (Button)popupView.findViewById(R.id.btnPopUpAiCancle);                          
btnDismiss.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View v) {
popupWindowDi.dismiss();
}});`
于 2012-08-06T07:17:03.467 回答
0

看看制作一个对话框片段 和这个答案

于 2012-08-06T07:12:57.160 回答