how to dim the current activity? - android

Is there a way to dim the Current activity when calling the new activity? as in the new activity should be above the previous activity. The new activity that i have is a gallery. It comes when the finish button in the previous activity is clicked. So i want this gallery to be placed above the previous activity

Try setting the background of your gallery Activity to a transparent color. You might need to create a custom theme and more details can be found here: http://developer.android.com/guide/topics/ui/themes.html
This is probably going to be completely transparent, so not quite what you want. But, for example:
<activity android:theme="#android:style/Theme.Translucent">

I doubt if you could overlay two activities on top of each other. However, in order to achieve the effect that you mentioned, you could use a customized dialog to popup within your main gallery activity, and then set the rest of the screen as blurred, with the use of window manager. For an example of this, you can see: http://www.stealthcopter.com/blog/2010/01/android-blurring-and-dimming-background-windows-from-dialogs/

Related

How to show content of Activity in full screen without flicker

how to make activity full screen and navigate back to previous activity without any UI flicker.
full screen activity
use Theme
<activity android:name"MainActivity"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
and navigate back to previous activity without any UI flicker
is mean how to make back button?
You can choose between two options
Apply new exit animation of Activity, such as fade out, scale out, .... It will reduce the lagging-effect to the eyes.
Use Fragment instead. Fragment transition is smoother than activity transition.
Try both ways and compare them to get the better options. I recommend you the second :D

Creating 2 activities and view programmatically. I want to create the view of second activity transparent

I have requirement of creating two activities and their layout programmatically. And I want to create something like this,
Create a first activity and with a fixed background and second activity which will have a transparent area at all side so there the view of first activity will be shown.
Right now I am creating one activity and it shows OK.
and
setTheme( android.R.style.Theme_Translucent );
when i open second activity the view shows with margin but with the plain background and not the transparent view of first activity.
I have set the back ground of second activity like this, rLayout.setBackgroundColor(Color.parseColor("#80000000"));
It is showing the grey color at background.
I know a one work around by creating dialog, But it would be better to use activity as per our requirement.
You can create a transparent theme in styles and then use that style for your transparent Activity.
Refer to this answer:
How do I create a transparent Activity on Android?

Transparent activity like dialog without previous activity under it

I want to show transparent dialog-like activity when my app goes to background. But after it shows I can see the last running activity underlaying. Can I show only my transparent activity without finishing previous?
I found solution. I have been used System alert instead Activity.

Disable activity that starts another activity

I have a popup which I implement with an activity, e.i the activity doesn't fill the whole screen, and looks like a popup.
How can I disable the caller activity? (The background activity).
I want the same functionality as if I used a classic popup:
popup.setOutsideTouchable(false);
Thanks in advance!
you can create an activity with
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen".
There add your view over the transparent activity like a popup.

Change focus of activities in android

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.

Categories

Resources