I want to Open a Popup View on click of a Button, But the Activity behind the PopUp should be visible as the Background of the Created PopUp needs to be Transparent on demand.
Asked
Active
Viewed 1,482 times
0
-
I have no idea what to do!!! M searching for the Soultion. – David Brown Aug 06 '12 at 07:15
3 Answers
2
you can do as below
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();
where temp is your transperent layout.

Dhruvil Patel
- 2,910
- 2
- 22
- 39
-
Thanks xitij, Got it done by simply making the Theme Transparent in the AndroidManifest.xml file. "android:theme="@android:style/Theme.Translucent.NoTitleBar" – David Brown Aug 06 '12 at 07:19
1
My code for popup :-
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();
}});`

grv_9098
- 465
- 5
- 16