Answer the question
In order to leave comments, you need to log in
CoordinatorLayout and fitsSystemWindows?
Good evening!
The task is to display a photo under the status bar and toolbar. For scrolling, I use CoordinatorLayout and a custom Behavior, in which some transformation will be implemented in the future. In the video, the blue bar is "sticky" to the AppBarLayout using attributes:
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom"
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|snap">
<FrameLayout
android:id="@+id/main_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:orientation="vertical"
app:layout_collapseMode="parallax">
<com.example.DynamicRelativeLayout
android:id="@+id/dynamic_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</com.example.DynamicRelativeLayout>
</FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.example.ui.ExpandableLayout
android:id="@+id/expandable_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:el_contentLayout="@layout/order_details_content"
app:el_headerLayout="@layout/empty_layout" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<include
android:id="@+id/details_header"
layout="@layout/order_details_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom"
app:layout_behavior="com.example.OrderHeaderBehavior" />
<include
android:id="@+id/toolbar"
layout="@layout/transparent_toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize" />
</android.support.design.widget.CoordinatorLayout>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question