Fragment empty when hidden then shown - android

Ok, this is odd. I am having a problem with the fragment manager with add and replace. So, instead im just loading all of my fragments, and hiding them (which is only 3 fragments). Well, on one of the fragments, if I dont hide it, it works fine. But, if I hide it, then show it again, its just an empty black space. Anyone else run into this issue?

Related

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:

How to display fragment in android with background grayed out?

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

Android adding fragments at runtime causes flicker

I have a main activity with content - a WebView.
Basically, when the user opens the application, I do a quick check if they are logged in. If they aren't logged in, then I inflate the login fragment.
At this point, you get a flicker of the WebView underneath before the fragment is inflated. It's a little bit clunky. It has made other things worse by the fact that I have to hide/show the actionbar in the same step.
Is there any solution to get around this? I guess I can hide my WebView until needed, but the actionbar will still be shown for a moment. Any suggestions for this problem?

Hide Progress Dialog from background-fragment

I'm encountering the following problem. I implemented a navigation with tabs and viewpager to swipe through my fragments. This is working fine so far.
But the fragments are all loading data via Async Task and for that they are showing an progress dialog. Which is self is also working as it should. My problem is, that because of the Viewpager not only the actual fragment is loaded but also the one next to it. So I see wrong progress dialog.
Is there any way, to achieve a behavior that the progress dialog stays visible for it's fragment (so, that the user is informed, when he moves to the next tab before the async task finished loading) but not anywhere else?
Hope it's clear, what I wanted to say.
Thanks for your help.
Best wishes
The progress dialog can be a "dialog" that hangs out in front of everything, or it can be a View that sits in place. So, my advice would be to make either a full screen (or just partial screen) layout that sits in your fragment and displays the progress dialog. It will move aside with the rest of the fragment if the user moves to a different fragment. If you set it at the top Z level, make it full screen and capture all taps to it (and swallow them so they don't cascade down into the layouts beneath in the z-order) I believe you'll have exactly what you're describing as your desired result.
The key is not to use ProgressDialog dynamically in code, but rather just the View version of it that you just place in your XML.
Edit:
I'm talking about one of these...
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>

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