Disable fading between dialogue and main activity
I created a small application that uses "android: theme =" @android: style / Theme.Dialog "" in it manifest. This way it will appear as a dialog, so the background will be semi-transparent and darkened. During the lifecycle of the activity, another dialog will be shown. However, after the dialog has been fired, the background freezes for a short time and then disappears again to match the theme of the application.
I could turn off this behavior using
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
But using this will lead to dialogue that doesn't diminish activity.
Is there a way to achieve the desired behavior?
-Activity background should be translucent and dimmed
-Dialog should dimm the activity layout
-No fading when dialog is dismissed
Complete code:
public class DialogDimActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void onClick(View v) {
Dialog d = new AlertDialog.Builder(this)
.setNegativeButton("Close", null)
.create();
// d.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
d.show();
}
}
+3
source to share
No one has answered this question yet
Check out similar questions: