Android: ActionBar like the stock browser - android

I want my ActionBar to act like it does in the stock/default Android browser:
It visible at the top of the page, but as the user scrolls down, the bar scrolls out of view, how ever if you scroll the page upward towards the top, the bar comes in to view again, but will hide after some time out, when it does this, it does not affect the underlying view.
I've tried implementing auto-hiding using timers but when the ActionBar hides, it moves up the scrollable view underneath so it looks as is my whole page shifts up instead of the ActionBar floating over the top of the view.

You are looking for the action bar overlay mode in combination with the Quick Return pattern. That is the feature, where a view becomes visible on top again when the user scrolls up a little. See this excellent blog post describing this pattern. Don't miss the example implementation by Roman Nurik from Google.
Enable the overlay mode by requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY) before setContentView() or by setting the theme attribute android:windowActionBarOverlay to true.

Did you try the overlay mode on the ActionBar, getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY)?
Then add a marginTop to your main layout.

Related

How bottom toolbar will always be pushed up when keypad is used?

I want to place a toolbar at the bottom similar to the below, sample post compose, screenshot highlighted in green.
But the toolbar should be pushed up when the keypad comes up while entering text as below sample screenshot.
I can design the button toolbar, but no idea how to make it always visible when using keypad. Request to provide sample code for achieving this.
There are two modes for how Android can display the screen with the keyboard up- resize or pan. In pan, the application is scrolled up such that the cursor is assured to be on the page. In resize, the app is resized to fill the space left after the keyboard isplays.
You want resize. But that's not sufficient. Your layout for the screen needs to be such that the toolbar is fixed to the bottom of the screen and that the stuff above it is flexible in size. The best way to do this is to use a RelativeLayout or ConstraintLayout for the root, and to put the toolbar to align to the parent on its bottom. Make that top bar with the post button do the same with the top. Then have the stuff between them be fill_parent and have it layout below the top bar and above the bottom bar.
The end result of all that is that the top and bottom bars will be put in a fixed position, and the center part will be laid out inbetween. Note that this could result in some elements not appearing on screen until the keyboard is dismissed, because they won't fit. Putting the contents in a ScrollView can mitigate that problem, so the user could scroll to it.

How to use Bottom Nav View and AppBarLayout as an overlay and animate them in Android

I wanted to know how to use Bottom Nav View and AppBarLayout as an overlay and animate them (hide/show together on touch) just like apps like Camscanner do when viewing image? I want this behavior so that the canvas beneath it can use fullscreen.
Update
Note: This screenshot is from Gallery Go app by Google, it also hides the ActionBar and BottomNavBar.
Update 2
I used the UiAutomatorViewer to check the app's UI and found that it actually uses a LinearLayout with ImageViews for the AppBar and TextViews for the Bottom Nav View.

Strange behavior of a bottom navigation view when is set visible

I try to make an app using one activity multiple fragments pattern. I handle navigation with Navigation architecture component using a bottom navigation view. In one of the fragment I have a Recyclerview which displays a list of custom cards. On item click it navigates to another fragment where I need to hide the bottom navigation view.
The problem appears when I navigate back and set the bottom navigation view visible again. The bar seems to appear in two steps giving the feeling of lag. (first time appears just 60% of the bottom navigation view).
The behavior seems to be related with the status bar. When I change the theme to full screen or I set windowTranslucentStatus=true, everything behaves okay. In addition, first time the nav bar seems to be with exactly 24dp smaller, that is the dimension of status bar.
Have you any idea what can I do?
PS. I'm new on stackoverflow and this is my first question. I'm glad to join this wonderful community.
Delay is one way to go, but I wouldn't suggest that.
I am assuming that the your navigation view is rendered before the entire activity is rendered, which is causing it to be rendered again after the UI is rendered. Why don't you try setting the visibility after the UI is rendered, like here

Bottom Navigation View in Support Library v25.0.0 animation?

Reference: Nick Butcher's Tweet
https://twitter.com/crafty/status/789008273949200384
I implemented Bottom Navigation View came out with Android Support Library v25.0.0.
https://github.com/vipulasri/Bottom-Navigation-View-Sample
I am facing following problems:
Floating Action Button overlaps with Bottom Navigation View.
Snackbar displays above Bottom Navigation View.
Bottom Navigation Button doesn't automatically hide or appear on scrolling.
Not able to get the reveal animation like below:
About your third and fourth question. Bottom navigation view is automatically hide title and make animation if you have more then 3 item in it.
And about you first and second question. You can try another root layout, for example CoordinatorLayout.
Maybe it's late, but I made a little project to make reveal animation on background like your example without third part library.
Check it here: https://github.com/GauvainSeigneur/CircularRevealBottomNavigationView

How does instagram fixed and change the bar when scroll up in android?

Notice: I cannot provide pictures due to my reputation.
When we scroll down from the feed in instagram the action bar is actually hide and a white bar that indicate the user name and time is fixed at the top. When we scrolling down again the previous white bar will scroll up and next bar will fixed at the top again. I want to make something like that for my school project.
So my first question is how can I hide the action bar while scrolling up and show it again while i scrolling down?
Second question is how can I make the white bar just like how instagram did it?
Any help will be highly apperciate!!
I am not a 100% sure what to do to accomplish the movable action-bar, but you may want to look into "toolbar" which may provide more manipulation potential.
http://www.google.com/design/spec/layout/structure.html#structure-toolbars
http://developer.android.com/reference/android/widget/Toolbar.html
http://cyrilmottier.com/2013/05/24/pushing-the-actionbar-to-the-next-level/
Also, if you are looking for the white part that has to do with usernames and such inside instagram, you should look for an effect called sticky-headers.
Awesome library to quickly add list view animations, such as sticky-headers
https://github.com/nhaarman/ListViewAnimations

Categories

Resources