How to display fragment in android with background grayed out? - 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

Related

How to make DialogFragment show on android home screen?

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?

Clicking edit text in fragment causes toolbar to slide off screen

The layout fits perfectly in my fragment normally, but it is a chatting app with an edit text on the bottom of the fragment. If I click the edit text, the fragment gets pushed up and half the fragment goes off the top of the screen.
Reading other answers, I know for activities this issue is resolved by adding the adjustResize option in the xml. Tried adding it for the entire app in my case, but that still didn't fix the issue. Anyone else have this problem?
pictures:

ActionBar animation does not stop

I am using ActionBar Sherlock with a number of fragments.
The app I am building is a basic RSS reader much like the one shown here (http://www.youtube.com/watch?v=R_qR2glTTAs), except that there are multiple tabs for several different RSS feeds. When a tab is clicked, I replace the active fragment with the appropriate new fragment.
I am trying to get ActionBar animated refresh button functionality much like it is depicted in the YouTube video above. Basically, when the user clicks the refresh button, I expect the refresh button to rotate until the refresh is complete. If the user switches tabs while the current tab is refreshing, I want to show a refresh button that is NOT rotating.
The problem is: after I click on the refresh button and the button starts rotating, if I switch to another tab, I simply get a non-rotating refresh button on top of the rotating refresh button! This happens despite my calling menu.clear() and recreating the menu each time a tab is clicked. Interestingly, rotating the device causes the extra rotating refresh buttons to disappear.
Nothing I've tried seems to be able to stop the refresh animation when I change tabs! Any ideas why? I can post more of my code here if necessary.
I think the problem could be that you are animating and / or creating the menu inside your fragements... if this is the case do the things you want to do with your menu in the FragmentActivity
By the way, the effect you experience while rotating the screen is caused by the android architecture. Android always recreates the view if you are switching from portrait to landscape mode or the other way around.

Is it possible for a custom view, intended to slide over the main activity, to partially show itself, while the main activity is in focus.

I want a view which is partially visible on the main activity and if we click on it, it slides up and shows up completely. Something like "click to show details".
One workaround I have thought of is that when the main activity is in front, a button which looks like the partial custom view appears. On clicking that button, the custom view slides up.
I found an unanswered question which asks for the same solution as I.
Yes I found a library called StandOut https://github.com/pingpongboss/StandOut
this might be useful for what you want.

Rendering bugs when SoftKeyboard closes

I have the following problem:
I have a FrameLayout with a main Fragment, which is always shown, and some overlay "extra" fragments which are shown or not, depending on the state of the application. (This Layout is used on tablets)
Now, if the user initiates a dialog with an EditText, this causes the SoftKeyboard to appear.
The Dialog and the Keyboard(No matter which type of dialog, I tried AlertDialog and DialogFragment) overlays the other Fragments.
So far, so good.
But when the dialog is finished and the keyboard closes, my whole application is pushed a bit up and down in an animation, and then there are several rendering bug in the ActionBar and at the bottom edges of my fragments.
This happens only if the keyboard overlaid exactly one of my "extra" fragments. (If it overlays two fragments, then everything is good).
Anyone an idea how to get rid of this?
Configuring android:windowSoftInputMode does not help.
You can adjust your keyboard in fragment using
getActivity().getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

Categories

Resources