i have an activity which is to be converted to an popup. so i used
SetTheme(Android.Resource.Style.ThemeDialog);
to make it look like an popup. but the problem is it looks like a popup but previous activity is not visible on back. i get a black background. what i am doing wrong. little help will be great.
i couldn't fix it using SetTheme(Android.Resource.Style.ThemeDialog);
so i changed the activity to dialog fragment and now it works fine.
Related
The hosting blank activity is shown behind the dialog, but I want it to be shown on top of the home screen. Is there a way to "hide" the activity since nothing is shown inside of it anyway? The activity is needed because I am planning on showing another dialog after the user clicks a selection from the first one.
Figured it out! For anyone wondering, the answer is to make the activity transparent. Here's another stack overflow question that describes how: How do I create a transparent Activity on Android?
When a RelativeLayout in an activity is clicked, it should open a fragment that shows a few checkboxes. The fragment should be in the center of the screen but should not cover the whole screen. The original contents activity should appear in the background but it should be grayed out. When I click 'OK' button in the fragment, the fragment should disappear and the original contents of the activity should appear normal (without graying out). I've tried writing a lot of code but what I get is completely different from what I have in mind. How can I achieve this functionality?
you should use DialogFragment , see this thread: https://developer.android.com/reference/android/app/DialogFragment.html
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.
This question already has answers here:
Actionbar background is not being changed
(2 answers)
Closed 8 years ago.
In my application, I am using actionbarsherlock. I use
getSupportActionBar().setBackgroundDrwable(R.drawable.test).
It works fine, the color is showed as expected, however when I go to another activity and go back to the main activity. The bar color is changed to black (in my program, I dont set black for the backgrounddrawble and just call setSupportAction().setBackgroundDrawable in onStart()). However, if I change the code to
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xff550000)));
The app works fine. When I click on back button, the color is set to 0xff55000 which is expected.
I will suggest not to use the color code directly this way while you are trying to set the color programmatically. It will not take it. just try out this way..
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(mContext.getResources().getColor(Color.BLACK)));
Hope it will work for you.
It doesn't work well for me either, specially if I use with the navigation drawer toggle list. In my case, if i don't use the toggle, the background goes white during a second and then load the background drawable. If I use the toggle, the background remains white.
I had to use a custom view to achive the effect I wanted to get instead of changing the background.
I have almost the same issue, it happens that calling getActionBar().setBackgroundDrawable twice does not work.
If I only call it only once in the onCreate is works. If I put the code in the onResume, it works for the first onResume, but it is set to grey for any other onResume
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.