0

Meine collapsible toolbar funktioniert, aber deckt den Titel, als ich versuchte, mit einem nestedscrollview nach oben zu scrollen. Ich habe versucht, es in relative Layout zu setzen, aber dann die toolbar funktioniert nicht mehr und würde nicht mehr kollabieren.Wie arrangiert man Ansichten innerhalb von coordinatorlayout?

Hier ist mein 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> 

Antwort

1

App: layout_behavior = "@ Zeichenfolge/appbar_scrolling_view_behavior"

Gerade diese Zeile setzen in Ihrem NestedScrollView.

Verwandte Themen