Processing Android SplitView using Frangments - android

I am working on an app which needs to implement splitview functionality in android. I have created splitview using fragments. When the orientation of screen is portrait the left fragment is hidden and a button 'details' (outside fragment) is shown (in place of left fragment) leaving the right fragment visible as it is. When i click the details button the hidden left splitview should be visible. How to achieve that??
Note that the right fragment is visible throughout the app.

Basicly you have 2 fragments on the screen right?
Well, so load the buttonFragment on the left(leftFrameLayout?) sameTime as you load the rightFragment on the right(rightFrameLayout).
When you push the button, you detach the buttonFragment and attach the leftFragment to the left(leftFrameLayout)...
I'd guess something like that?
If you are looking for fragment guide, here is a simple one:
Lars Vogellas fragment guide

Related

How are transaction between two fragment in BottomNavigationView in Apps like YouTube so smooth?

I am making an application that has MainActivity that contains BottomNavigationView and FrameLayout above it. There are 3 Fragments say Fragment A, B, and C.
My doubt is, How do I make switching of Fragments as quick as YouTube Android application? By saying quick, I mean that, when I am on "Home" tab of Youtube application and I switch to the "Trending" tab and again go back to the "Home" tab, it simply loads "Home" tab within fraction of seconds, as if it just hided the inflated page in background and showed up when selected from BottomNavigationView. And also, It inflates the page exactly to the same position where I left.
When I am trying to implement the same in my Application, the RecyclerView in Fragment A re-inflates if I come back from Fragment B.
I am expecting the idea how they do it and in which method they do it (For eg. onStart or onDestroy or onViewCreated)...
If you are using viewpager then Increase the viewpager offset limit
viewpager.OffscreenPageLimit = 2;
Tt's limit is one by default. I hope this may fix your issue.
Thanks

overlay over fragment and disable fragment functionality

I have a fragment that fits half the screen which I want to put an overlay over and I want the fragments functionality (scrolling and clicking on items in it) to be disabled. I also want the activity to register a click anywhere on the disabled fragment (which will remove the overlay and re enable the fragment)
My first idea was to try find a way to pause the fragment, but nothing really worked, so now I am thinking about putting another fragment or possibly dialogue over the fragment and so that it covers the scrollbar and clicks in the fragment and registers its own clicks. Would this be possible? Would it be better to do it with a fragment or dialogue?

ViewPager with static content

I want to create application which structure can be simplified as this:
Where Events tab has static content in our stackoverflow world, and is not reloading when app is working. So we can simplify it as a ViewPager.
Problem is with reloading Home tab, because when we set option in Drawer, accurate fragment should replaced Home tab.
Question
So here is my question, is it something similiar to ViewPager which replace current window from right side ? Because I replacing fragment in view pager is quit hard, so I want to replace home fragment in traditional way.
I`m not sure what your problem is. You don't want to update home fragment, you just want to replace it, so replace it and notify viewpager adapter for your change, save preview fragment before that and override back button press logic to replace again whit backuped fragment.

Android Sliding fragment instead of menu

I would like to implement an activity with 2 fragments in tablet app. Fragment A on left and second fragment B with some additional info on the right. Lets say each fragment has half of the screen width. Now I would like to add the option to slide the right fragment B to the right side of screen and let the fragment only e.g. 10 % of width (so fragment A can expand to 90%).
So fragment A now can has more space and fragment B can be slided to the middle back again. I would like to ask if there is a library that can help me or if there is already functional solution of this.
I have never worked with SlidingDrawer that seems to be right but now it is deprecated.
Download this library:
https://github.com/jfeinstein10/SlidingMenu
Check here how to implement:
Dynamic UI with sliding menu and actionbarsherlock

How to put tabs containing ListFragment on the left and a details panel on the right?

I have to show two tabs each containing ListFragment classes. On clicking any item of the list, it's details should open on the right panel on landscape views. This is much like the official Android fragments example.
What I want to achieve is that on the left side of the layout the list view should be in tabs, i.e. two list views within tabs. On clicking any item the details should open on the right. Till now, I can show tabs and details, but the details are not showing up on the right. They open as a new activity.
Tab Navigation can be an option, but due to some design restraints in my app, I can't use that. Please guide.
Please check this android blog http://android-developers.blogspot.com/2011/02/android-30-fragments-api.html It has a complete tutorial of how to use fragments as a Master-Details View.
I came to a solution. I am explaining how I did it, in case someone needs it.
I wanted to make tabs on the left fragment. Due to design constraints, I could not use Tab Navigation, as I had to use List Navigation too.
So, I made a new fragment placed over the left fragment and inflated it with two buttons. On different button clicks, I used FragmentTransaction to add new fragment to the left fragment.
On button click listener I used fragmentTransaction.replace method.

Categories

Resources