Created
August 14, 2019 04:11
-
-
Save AnwarShahriar/685e5a1cdda2b76d07d3f7d3ac65430b to your computer and use it in GitHub Desktop.
Coordinator layout test with multiple static view and one scrollable header in between.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<RelativeLayout | |
android:id="@+id/topBar" | |
android:layout_width="match_parent" | |
android:layout_height="48dp" | |
android:background="#000000"/> | |
<androidx.coordinatorlayout.widget.CoordinatorLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_below="@id/topBar" | |
tools:context=".MainActivity"> | |
<com.google.android.material.appbar.AppBarLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:fitsSystemWindows="true"> | |
<com.google.android.material.appbar.CollapsingToolbarLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fitsSystemWindows="true" | |
app:layout_scrollFlags="scroll|snap|exitUntilCollapsed"> | |
<View | |
android:layout_width="match_parent" | |
android:layout_height="70dp" | |
android:background="@color/design_default_color_primary"/> | |
</com.google.android.material.appbar.CollapsingToolbarLayout> | |
<LinearLayout | |
android:id="@+id/container" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="vertical" | |
android:background="@color/colorAccent"> | |
<Button | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Change Size" | |
android:onClick="addATextView"/> | |
</LinearLayout> | |
</com.google.android.material.appbar.AppBarLayout> | |
<androidx.core.widget.NestedScrollView | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> | |
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="vertical" tools:showIn="@layout/activity_main"> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="100dp" | |
android:text="1" | |
android:textSize="32sp" | |
android:textStyle="bold" | |
android:gravity="center"/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="100dp" | |
android:text="2" | |
android:textSize="32sp" | |
android:textStyle="bold" | |
android:gravity="center"/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="100dp" | |
android:text="3" | |
android:textSize="32sp" | |
android:textStyle="bold" | |
android:gravity="center"/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="100dp" | |
android:text="4" | |
android:textSize="32sp" | |
android:textStyle="bold" | |
android:gravity="center"/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="100dp" | |
android:text="5" | |
android:textSize="32sp" | |
android:textStyle="bold" | |
android:gravity="center"/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="100dp" | |
android:text="6" | |
android:textSize="32sp" | |
android:textStyle="bold" | |
android:gravity="center"/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="100dp" | |
android:text="7" | |
android:textSize="32sp" | |
android:textStyle="bold" | |
android:gravity="center"/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="100dp" | |
android:text="8" | |
android:textSize="32sp" | |
android:textStyle="bold" | |
android:gravity="center"/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="100dp" | |
android:text="9" | |
android:textSize="32sp" | |
android:textStyle="bold" | |
android:gravity="center"/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="100dp" | |
android:text="10" | |
android:textSize="32sp" | |
android:textStyle="bold" | |
android:gravity="center"/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="100dp" | |
android:text="11" | |
android:textSize="32sp" | |
android:textStyle="bold" | |
android:gravity="center"/> | |
</LinearLayout> | |
</androidx.core.widget.NestedScrollView> | |
</androidx.coordinatorlayout.widget.CoordinatorLayout> | |
</RelativeLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment