Reputation: 77
My collapsible toolbar
works but covers the title as i was trying to scroll up using a nestedscrollview
. I tried putting it inside relative layout but then the toolbar
stopped working and wouldn't collapse anymore.
Here's my layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cordinator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
tools:context="com.store.android.basic.Introduction">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/introduction_toolbar"
layout="@layout/app_toolbar" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id = "@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="@string/heading"
android:textColor="#D31F33"
android:textSize="25sp"
android:textStyle="bold" />
<TextView
android:id = "@+id/sub_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/text_one"
android:textSize="18sp" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Upvotes: 1
Views: 1649
Reputation:
app:layout_behavior="@string/appbar_scrolling_view_behavior"
Just put this line in your NestedScrollView.
Upvotes: 1