Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable background dim on ProgressDialog/AlertDialog in Android

Tags:

I use an AsyncTask with a ProgressDialog in it. This automatically causes a background dim of about 40%. I want to turn this dim off (0% dim), but what I tried, didn't work:

myLoadingDialog = new ProgressDialog(MainActivity.this.getApplicationContext()); myLoadingDialog.setMessage("Loading..."); myLoadingDialog.setIndeterminate(true); myLoadingDialog.setCancelable(false); WindowManager.LayoutParams lp = myLoadingDialog.getWindow().getAttributes(); lp.dimAmount = 0.0f;  myLoadingDialog.show(); 

The problem with that dim was, that I had to terminate my Tablet's SystemUI-Process to achieve a Kiosk mode (with no System-Bar) and the ProgressDialog dims everything but the area where the System-Bar was, so I have a bright border at the bottom of the screen.

If there is a way to get a complete fullscreen-dim, I would be also happy.

Thanks for any help

like image 631
Day Avatar asked Oct 17 '12 16:10

Day


People also ask

How do I turn off AlertDialog on Android?

AlertDialog generally consists of the main title, the message, and two buttons, technically termed as a positive button and a negative button. Both positive and negative buttons can be programmed to perform various actions. By default, the negative button lets close the AlertDialog without any additional lines of code.

What is ProgressDialog?

ProgressDialog is a modal dialog, which prevents the user from interacting with the app. Instead of using this class, you should use a progress indicator like ProgressBar , which can be embedded in your app's UI. Alternatively, you can use a notification to inform the user of the task's progress.


1 Answers

use

myLoadingDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHI‌​ND); 
like image 167
Mohsin Naeem Avatar answered Oct 04 '22 01:10

Mohsin Naeem