Flexible headers below the Android content

1

Looking through the material design design guide , there is a scroll called Flexible space with overlapping content that the ActionBar when expanded is displayed below the content and when scroll is collapsed.

How can this overlapping of content be done?

Here a video of what I want perform

    
asked by Webserveis 17.08.2016 в 20:41
source

2 answers

1

Try the following code:

<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:behavior_overlapTop="64dp">

the important thing is the line:

app:behavior_overlapTop="64dp"
    
answered by 17.08.2016 / 20:50
source
1

To the NestedScrollView you can add it with setOverLayTop from code:

NestedScrollView scrollView = (NestedScrollView) getActivity().findViewById(R.id.tu_nestedScrollView);

CoordinatorLayout.LayoutParams params = 
    (CoordinatorLayout.LayoutParams) scrollView.getLayoutParams();
AppBarLayout.ScrollingViewBehavior behavior =
    (AppBarLayout.ScrollingViewBehavior) params.getBehavior();
    behavior.setOverlayTop(128); 
    
answered by 17.08.2016 в 20:53