1

리사이클 러 뷰 조각에서 아래로 스크롤 할 때 도구 모음을 숨기고 표시하려고하지만 CollapsingToolbarLayout이 수행 할 작업을 수행하지 않습니다. 리사이클보기 조각에 있기 때문에CollapsingToolbarLayout이 무언가를 축소하지 않습니다

이 그 것이다 (그것이 작동하는 때이다)

먼저 난 그냥 코디네이터 레이아웃을하려고 노력하고 일했다,하지만 붕괴 도구 모음 레이아웃만큼 유체 아니다 ? 문제는 정확히 무엇입니까?

홈페이지 레이아웃 : 조각 레이아웃의

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:elevation="7dp"> 

<android.support.design.widget.CoordinatorLayout 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    tools:context="com.github.mpivchev.app.activities.MainActivity"> 

     <android.support.design.widget.AppBarLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:elevation="2dp" 
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

      <android.support.design.widget.CollapsingToolbarLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

       <android.support.v7.widget.Toolbar 
        android:id="@+id/toolbar" 
        android:layout_width="match_parent" 
        android:layout_height="?attr/actionBarSize" 
        android:background="?attr/colorPrimary" 
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

        <RelativeLayout 
         android:layout_width="match_parent" 
         android:layout_height="match_parent"> 

         <Spinner 
          android:id="@+id/spinner" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_marginTop="8dp" 
          android:gravity="start" 
          android:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
          android:spinnerMode="dialog" /> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:layout_alignParentStart="true" 
          android:layout_centerVertical="true" 
          android:fontFamily="@font/roboto" 
          android:paddingTop="18dp" 
          android:text="TestString" /> 
        </RelativeLayout> 

       </android.support.v7.widget.Toolbar> 
      </android.support.design.widget.CollapsingToolbarLayout> 
     </android.support.design.widget.AppBarLayout> 

    <FrameLayout 
     android:id="@+id/fragment_container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" > 
    </FrameLayout> 
</android.support.design.widget.CoordinatorLayout> 

<android.support.design.widget.NavigationView 
    android:id="@+id/navigation" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    app:headerLayout="@layout/nav_header_main" 
    app:menu="@menu/main_drawer" /> 

부분 :

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
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.support.v7.widget.RecyclerView 
    android:id="@+id/recycler_view" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:scrollbars="vertical" 
    app:layout_constraintEnd_toEndOf="parent" 
    app:layout_constraintStart_toStartOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/> 

... 

</android.support.constraint.ConstraintLayout> 

답변

0

툴바에 정의 된 collapseMode을 가지고 있지 않기 때문에 행동해야하는지에 대한 지시가 없습니다. app : collapseMode = "pin"을 툴바 xml에 추가하십시오.

+0

여전히 작동하지 않습니다 – Milen

+0

@Milen이 질문을 다시 읽습니다. 나는 툴바가 무너지고 있지 않다는 말을하고 있다고 가정하고있었습니다. 내가 옳은 문제를보고 있는지 확인하고 싶습니다. 그게 네가하는 일을하지 않는다는 뜻인가? –