I have a Fragment with TabLayout, and selecting by current tab it shows the selected month info, not hiding tabs bar and don't using for that many fragments, just updating the view. And now i need swipe tabs by finger sliding. I've searched and watch many examples which using ViewPager and many Fragments to describe each tab.
So how can i do this using only one fragment not other fragments?
Related
I have a hard time with trying to learn Navigation Components.
In my app, I have 6 fragments.
Four of them are swipeable by using ViewPager 2
Fifth fragment is not implemented in ViewPager, so user can't go there by swipping
Sixth fragment is just a host for ViewPager, since the other fragments are used by Navigation Components
I can swipe fragments for now, but whenever I try to use Navigation Components, I getting error about action/destionation. It's simply about calling for example ActionFrag1ToFrag5 from my Host Fragment
It seems like I can browse through fragments, but I can't cast any Navigation Component functions, because the fragment stays the same, it doesn't change label after swipe to another one.
Is there a way to get proper NavController from specific fragment, or it's just my poor implementation?
If Frag1, Frag2, Frag3, and Frag4 are those in the ViewPager and you want to go to Frag5.
The direction needs to be from the Frag6 that is hosting the ViewPager to the Frag5.
Scenario: I have three fragments in ViewPager. I have one list in one fragment.
Problem:I want to hide viewpager tabs and show only toolbar and list only?
Can anyone solve my problem
Inside my app I am using navigation drawer for my navigation. For each "page" I am using fragments (like showed here: http://developer.android.com/training/implementing-navigation/nav-drawer.html). It works completely fine, but now I want to create swipe tabs. I want to display those tabs only on one of the fragments. Problem is, that tabs are displayed on all fragments, which is ofcourse perfectly normal because tabs are inside action bar. What should I do, to display tabs only on one fragment?
From what I have understood, you are interested in showing action bar only in a particular fragment (not visible when swiping in subsequent fragments). The best way would be to code the action bar in fragment instead of using the action bar in main fragment and then creating swipe views (or sub fragments).
Hope it helps.
Is it possible to create a ViewPager with the following scenario?
I want to have a ViewPager with 5 fragments. These 5 fragments are bound to a ViewPagerIndicator. (already got this)
Now I want to create an extra fragment at the start before all other fragments and that the ViewPagerIndicator is not selecting anything when this fragment is the current item.
Does anyone know if this is possible?
I'm currently developing an application that has a tab bar, and 3
different views: the first is a master-detail, the second one a
gallery, the third is a simple webview.
I was using the TabActivity, but since Android 3.0, this class is
deprecated and Android reference
suggests to use Fragments.
I switched then to an ActionBar, with Tabs and Action
Items. Inseide the first tab item I have a layout with 2 fragments (my
master-detail view). When I switch through tabs I want that my layout
change as I described above, so I thought to hide the left fragment
(the master listview) and work only in the detail fragment.. but with
this solution I have only one main activity with a lot of fragments
attached to it, and for each fragment displayed I need to modify the
Action Item shown and handle different actions in
OnOptionItemSelected.
Is this a good way to implement this kind of
application or should I consider different solutions?
You should have a single fragment container where the fragments are replaced depending on the tab selected.
One activity and multiple fragments is the right approach.