I don't know how to describe this very well but I see it in a lot of apps such as Transit.
There is a main window and then a view below it such that when you scroll down, the top window slides up at a slower rate within its own view while the bottom view scrolls up at the same rate the user drags.
Is there a name for this technique?
I believe the effect you are talking about is of Coordinator Layout. You need to implement Coordinator Layout and define view that you want to scroll upward.
One of the example that you can use to learn is Mastering the Coordinator Layout.
Hope this helps. :)
Related
Look at this video: https://ibb.co/37V0Vgt. I wanted to create a activity with the bottom view(in the video) which you drag up and down. The view also snaps in two positions.
when it is fully expanded
all the way down
I have been searching for a way to create this kind of view but have found nothing. The problem is if you have a view at the bottom how can you expand it up just like in the video.
What I want is a solution on how to implement this kind of view. You would add it to the bottom of your activity layout and behave exactly like in the video. Is this something which already exists? Then what is it called?
This is a Botom Sheet. You can place a layout inside a CoordinaterLayout and apply the BottomSheetbehaviour to it to create this view.
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
You'll require the Material Components Library as stated here.
In your video, the Bottom Sheet is in the STATE_COLLAPSED state and can be pulled out.
I have a minor problem which i can't solve.
I have a layout with scrollview embedding a lot of views.
Everything work fine with the android studio preview in design mode but when i want to access to a view at the bottom, i have to scroll the mouse wheel very long time in order to reach the bottom of the layout. So it works but as soon as i make a change of the view located at the bottom i have to scroll the mouse wheel very very long time so:
Is there a shortcut to go to the bottom of the layout or something else?
Even if i click on the view in the component tree window beside the preview, it selects the view but doesn't displays it.
Thank you.
I am trying to create an activity layout with two parts, where their respective size is dynamic. The activity should have two states:
Starting state:
The user scrolls the bottom part up to the second state (and back):
It's important that the change will be animated. I tried a few solutions so far but didn't manage to find the exact way to do that:
AndroidSlidingUpPanel - The panel acts as another layout, covering the upper view and moving the toolbar out of the screen.
Android Split Pane Layout - Correct behavior, but the splitter is dragged and not the bottom part (I don't want to have a visible splitter).
CoordinatorLayout with CollapsingToolbarLayout - I didn't find a way to limit the upper part from totally disappearing. Anyway I think that it's a bit abusing because I don't want to collapse a toolbar but just change the children's height with animation.
Is there a good way to implement this using another library, one of these that I perhaps didn't use correctly or with simple layouts? Thanks!
I found a custom version of the SlidingPaneLayout created by VLC, which is basically a vertical SlidingPaneLayout - the exact functionality that I was looking for.
I've been using Phonograph music player for a while and it's a really good looking app in my opinion. It has a very nice sort of header: basically there's the toolbar wich slides up and down along with the recycler view hiding behind the status bar when scrolling down and coming back visible when scrolling up, the difference with other toolbars show/hide animations is that this one does not actually have two rigid states (hidden or shown) but instead it can be half covered, 70% covered, 80% covered and so on, it moves at the same speed of the recycler view, it's really different than the ActionBar.hide() .
Little clip to explain what I'm talking about:
http://i.imgur.com/JCIiFAA.jpg
I've searched the web for solutions but I haven't found nothing close enough but I think that the Observable Scroll View library might be a good starting point (Have already done some testings but so far it has those 2 rigid states wich I don't want).
I am using an activity MainActivity.java and setting its content view to activity_main.xml, how can I achieve that result?
Also how can I make that view pager selector just below the toolbar but sticky?
CoordinatorLayout from Design Support Library is what you are looking for.
See Tutorial here https://mzgreen.github.io/2015/06/23/How-to-hideshow-Toolbar-when-list-is-scrolling(part3)/
First of all you need to wrap up your Layout with Coordinator layout and set this flag on Toolbar
app:layout_scrollFlags="scroll|enterAlways"
Excuse my terrible paint skills, but that's a picture of my proposed layout.
I would like the blue part to be a RelativeLayout. Underneath the blue RelativeLayout is a ViewPager with Tabs, each tab containing a ListView.
What I'd like to do is be able to hide the blue layout as the user scrolls down the ListView, and reappear as the user scrolls up to the top of the ListView.
How can I achieve this?
Please have a look at this library ParallaxScroll
It very easy to implement and it supports both scrollviews, listviews wtc
I use the following to browse for new libraries etc..enjoy :D
You need to use lockable scroll view by this you can put your whole layout into it and lock the scroll at the specific location points on the screen