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
Related
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
I want to show 4 images like a slide show with translate (right to left) animation.
So I used ViewPager with 4 Fragments, and thread for automatic navigation to the next Fragment.
Everything was fine except navigation from the last item to the first.
In that case ViewPager scroll all Fragments (from left to right) to the first one, and this is the problem.
I need something like infinite navigating (right to left).
So what alternatives of ViewPager for doing this there are?
check this out , you can achieve using this
https://github.com/antonyt/InfiniteViewPager
hope it helps :)
I want to create an animation between two fragments on Android.
After clicking on the "menu" button, I want to scale[minimize] current fragment and move it to right corner of the second fragment like this:
Preview
And after click on this minimized fragment, I want to maximize it again with reversed animation.
Is it generally possible? How can I do this?
There are several libraries available for viewpager animations like
https://github.com/jfeinstein10/JazzyViewPager
https://github.com/ToxicBakery/ViewPagerTransforms
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.
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