I am using this Siliding menu https://android-arsenal.com/details/1/1398
On Home Page it load Fragment.
And i Want to design Home screen as http://blog.nkdroidsolutions.com/collapsing-toolbar-with-tabs-android-example/.
So, my question is
can we use coordinator layout and TabLayout(Which will have again three fragment) in Fragment?
if not what is other solution?
Related
I'm creating a single activity applicatition. Inside Activity there is a BottomNavigationView
with NavHostFragment. Bottom navigation view comprise of multiple menu items.
For easy to explain lets say there are three fragments "FragmentOne", "FragmentTwo", "FragmentThree"
each fragment have a different Toolbar. As a example "FragmentOne" is haveing a Toolbar with CollapingToolbarLayout, and "FragmentTwo" has a Normal Toolbar Design and "FragmentThree" has a toolbar with Image.
I have included different design Toolbars in each fragment and the BottomNavigationView is inside Activity.
Where select each bottom navigation menu, fragments are navigating correctly but content is showing fade in animation/transition.
I have set the app theme as Theme.AppCompat.Light.NoActionBar So now since Toolbar is also inside the fragment content area Toolbar also showing fade in transition.I'm okay with content transition but Toolbar should stay Solid.
Kindly help to me to solve this and feel free to request more information.
I would like to make a layout that it would be something like this:
A login layout with no toolbar or title bar
A select action layout with toolbar and no tabs
Another layout with toolbar and 3 tabs
and im thinking on how to implement this, how many fragments, activities etc.
I was thinking of having 1 activity full screen and another activity with fragments, toolbar and tab and every time i want a layut with tabs to remove the tabs and in the next screen to add again the tabs.
But after thinking it out it seems like a bad idea.
Should i create a seperate activity with fragments and tabs and navigate around those 3 layouts?
What is the best approach when you want to use tabs and a toolbar but you dont want in all your layouts to have tabs?
You only need 1 Activityand 3 Fragments. In the fragments where you need a toolbar, just use Toolbar view. This is available on Support Library so you will not have problems with older Android versions.
And in the Fragment with the tabs, just use a TabLayout and a ViewPager in order to switch between tabs (each tab is a Fragment).
I've created an app, that has a main activity with a drawer menu so the user can click on some option and a fragment is open inside the activity.
What I'd like to do is to have several screens in one of the options and to navigate between them by tabs/slide the screen.
I saw an example of doing it inside one activity and with a fragment per 'sub-screen', my question is: how can I do it when I'm already 'inside' a fragment?
Thanks
Fragments can support having other Fragments inside them. The key to making this work is to remember to use getChildFragmentManager() to get the Fragment's FragmentManager instead of getFragmentManager() which gets the Activity's FragmentManager.
If you want to swipe between views, use a ViewPager inside your Fragment UI. The ViewPager will use a FragmentPagerAdapter to handle the Fragments for display.
I've got a toolbar in a view-pager (tabbed toolbar with horizontal swipe navigation) and each tab has its own fragment with a recyler_view. I now want to hide the toolbar when my recyler_view scrolls. In my fragment i added the on scroll-listener and want to call there a method in its activity class to hide the toolbar. The toolbar is created in the activity. How can I call this method from my fragment? or would it be better to implement this hiding method in my fragment itself. But then how can i "contact" my toolbar, that is created in the activity and not in the fragment. I have found solutions, but none of them talks about a recylcer_view in a fragment and view-pager for tabbed navigation.
Would be great if you can help me...
I just had the same problem as you and solved it by using a library ObservableScrollView.
Have a look at ViewPagerTabRecyclerViewFragment.
If you don't want to use a library you still can have a look at how they implemented it as the lib is Open Source
so my ToolBar is in my MainActivity layout, along with a container underneath it for the fragments. All fragments have a ScrollView, I would like to hide the ToolBar when a Fragments scrollview is scrolled. What is the best way around having the fragment and main activity communicate?
To communicate between activity and Fragment, implementing an interface is the best option i know. Read more about it here http://developer.android.com/training/basics/fragments/communicating.html