I've got a little problem. When I use the showDialog() method of my Activity, it generates a perfect ProgressDialog, but the activity on the background (as the dafault behaviour) and becomes darker.
How can I avoid the darkening of my activity?
Try this:
Window window = dialog.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
Related
I want to change the transparency of activity dynamically when I move the root element/view. How to do that?. I'm creating a module for which when user slide down the whole UI down to half of the screen vertically to finish the activity. But by default when the user slides down the layout default color white of activity is shown and when I set its theme to transparent previous activity is shown. I want to change the opacity of activity window dynamically when user slides down.
use this where you need:
Window window = this.getWindow();
window.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
I have an activity that is using the Theme.Dialog style such that it is a floating window over another activity. However, when I click outside the dialog window (on the background activity), the button on activity start behaviour again. How can I stop this behaviour?
Use DialogFragment instead of activity
In an android application, I want to display a Dialog on screen and in the same time to allow user to click on the application's UI when the the Dialog is open
can this be done?
if no, what can I use instead of Dialog?
I don't think you can do this with Dialog. But you can do it with PopupWindow using PopupWindow.setOutsideTouchable(true);.
Showing up a dialog over your Activity, will make your Activity go into onPause() so you won't be able to actually handle things inside that activity anymore until the dialog is dismissed.
If you want to have some view, overlay your original activities view you'll be looking for into the direction of FrameViews, which can overlap other Views.
I am using a dialog themed activity in android to show a popup from a application context. The dialog has a transparent theme, but the issue is that I want the underlying activity to have focus and not the popup though the popup must be visble. How do I achieve this in android?
I think you would have to use a Fragment and just make it look like a popup dialog.
You can not switch focus between activities. There's only one activity "on focus" at the time, and is the one that is being displayed at that point. The transparent background doesn't mean you can access the activity below.
If i don't get it wrong, you want to be able to interact with the activity's controls while having a "Dialog" on the screen. Any sort of Dialog class from Android will not help, since they take the focus away. Not really sure about PopupWindow, but i'm guessing will be the same thing as the documentation says "that appears on top of the current activity."
You are going to have to create a custom dialog using a RelativeLayout/FrameLayout within your activity.
I have one Activity which displayed some Dialog boxes and Progress bars.
This activity does not have call to setContentView as this Activity does not have Screen Layout. It has been just used for displaying Dialogs and progress bar dialogs.
Now what happens is that Activity Displays Dialog box along with the Blank Activity Window on back of the Dialog, So i want to hide make it transparent so it will look like we are just displaying Dialog.
Thank,
PP.
Use this attribute for your activity
<activity android:theme="#android:style/Theme.Translucent">
This will make activity background transparent.
In your activity tag(in manifest) which is displaying progressbar or dialog
put this above attribute android:theme="#android:style/Theme.Translucent
This will work...
Try applying the dialog theme to this activity:
In your manifest file add to the activity element this attribute: android:theme="#android:style/Theme.Dialog"
Copied from background - Android: make everything around dialog darker
All you need to do is play around with the dimAmount field in the
WindowManager.LayoutParams:
WindowManager.LayoutParams lp = myDialog.getWindow().getAttributes();
lp.dimAmount = 0.7f