I want to achieve the following effect:
I have a RecyclerView with
android:fitsSystemWindows="true"
android:clipToPadding="true"
and while scrolling, the actionbar should hide by sliding out of the screen when "hit" by a certain element of my RecyclerView. As if it is being pushed out of the screen by the RecyclerView element. (So simply actionbar.hide() won't do). If the scroll stops with the actionbar having been pushed halfway out, it should hide completely. The actionbar should reappear when scrolling down again.
All in all nearly the same effect of the action bar in the newsstand app.
Related
Not sure if I'm fighting an uphill battle but I'm currently struggling with AppBar, Fragments and Bottom Navigation Bars.
I have a MainActivity that's a list view with an AppBar. It's created as a fragment with the intention to add another bottom navigation bar here in the future.
For now, when an item in the list is clicked it navigates to a detail view fragment. Here I still have the AppBar which is what I want however I would like to add a Bottom Navigation Bar. However when I navigate to the next fragment I lose my bottom navigation bar.
Is there a way to keep maintain Bottom Navigation Bars within Fragments? I tried breaking them out into activities but discovered then I lose my AppBar.
Is what I'm doing above feasible in Android?
Ideally I'd like this:
Do you have different nav graphs for different fragments? You need to have the detail view fragment in the same nav graph as the bottom navigation view. You don't need to have another item in bottom navigation but declare fragments that you want with bottom navigation in the same nav graph.
I am using coordinator layout with tabs, some of which (the tabs) contain a recycler view whilst some don't. All the tabs contain a floating action button. On scrolling the recycler view with the in one of the tabs, the floating action button is scrolled off by the coordinator layout. However, when I switch to the tab without the recycler view, and not being able to scroll, the tab remains scrolled off the screen (as it was done in the tab with a recycler).
How do I bring back the floating action button back when there is no way of scrolling in the tab without the recycler or any scroll mechanism?
Turned out to be a simply solution of translating the fab back in. floatingActionButton.setTranslationY(0.0f);
I think the way I was going is wrong. I wanted to create a top navigation bar which has 3 items so I created tabs and with a View Pager, I used 3 fragments for each tab. That way I can slide screens between each other, but the tabs are not moving along with the screen.
Can someone suggest me how to make top navigation bar items moving along with the screen is sliding?
This video explains exactly what I want. Please note how the top bar items are moving along with the screen.
https://drive.google.com/file/d/1OzDFR4VT_YyDumEZLOWtGZ-_5BLXAfK4/view
I need to handle the scrolling behaviour in my app. I have a screen with Colloapsing toolbar and tablayout viewpager. In this tablayout i have 3 tables.
First tab is content description. Second Tab and Thired Tab contains the List items.
Here the content of description and the list items is small i want to disable the appbar scrolling for each tab. If the content is large or list item is larger have to enable the appbar scrolling. Can any one know how to handle this..
I have a layout with a custom tabstrip (com.astuetz.PagerSlidingTabStrip) and a ScrollView.
What I want to do is: when the user scrolls down, the action bar should hide (translate up); when the user scrolls up again, the action bar should reappear.
I don't want the ScrollView to slide along with the actionbar. For this I used the Window.FEATURE_ACTION_BAR_OVERLAY flag, placing it under the actionbar. All works nicely this way, except for the fact that my custom tabstrip is initially hidden under the actionbar, only to appear when I scroll down.
Is there any way the tabstrip could be located under the actionbar initially, and slide along up when the actionbar is hidden? The ScrollView should be located under the actionbar at all times.