1

그래서 AppBarLayout 및 CollapsingToolbarLayout이있는 CoordinatorLayout이 있습니다. 여기 (오른쪽 이미지)AppBarLayout이 완전하게 접히지 않고 스크롤이 위쪽에 도달 할 때까지 부분적으로 만 확장되지 않습니다.

enter image description here enter image description here

나는 데 첫 번째 문제를 때 확장 된 (왼쪽 이미지)처럼 보인다 및 붕괴 무엇을 그 나는 두 textviews를 포함하는 블루 FrameLayout이를 아래로 스크롤 할 때 수행 붕괴하지 마라. 내가 원하는 것은 툴바가 완전히 접힐 때만 보이기 위해서이다. 나는 스크롤 플래그를 변경하고 뷰와 뷰 그룹을 돌아 다니며 움직이지만 성공하지는 않은 몇 가지 작업을 시도했습니다. 다음은 xml이고 windowTranslucentStatus가 true로 설정되고 툴바 제목이 비어있게 설정되어 있습니다.

나는 데 두 번째 문제

<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/main.appbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/AppTheme.AppBarOverlay" 
    android:fitsSystemWindows="true" 
    > 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/main.collapsing" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:fitsSystemWindows="true" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed" 
     app:contentScrim="?colorPrimary" 
     > 

     <ImageView 
      android:id="@+id/main.imageview.placeholder" 
      android:layout_width="match_parent" 
      android:layout_height="200dp" 
      android:scaleType="centerCrop" 
      android:src="@drawable/material_flat" 
      app:layout_collapseMode="parallax" 
      android:fitsSystemWindows="true" 
      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:title="" 
      app:layout_scrollFlags="scroll|enterAlways|snap" 
      app:layout_collapseMode="pin" 
      /> 
    </android.support.design.widget.CollapsingToolbarLayout> 


    <FrameLayout 
     android:id="@+id/main.framelayout.title" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|center_horizontal" 
     android:background="?colorPrimary" 
     android:orientation="vertical" 
     app:layout_scrollFlags="scroll|enterAlways" 
     > 

     <LinearLayout 
      android:id="@+id/main.linearlayout.title" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:orientation="vertical" 
      > 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_horizontal" 
       android:gravity="bottom|center" 
       android:text="Information" 
       android:textColor="@android:color/white" 
       android:textSize="30sp" 
       /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_horizontal" 
       android:layout_marginTop="4dp" 
       android:text="Tagline" 
       android:textColor="@android:color/white" 
       /> 

     </LinearLayout> 
    </FrameLayout> 
</android.support.design.widget.AppBarLayout> 

<android.support.v4.widget.NestedScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="yu.heetae.android.materialdesign.ScrollingActivity" 
    tools:showIn="@layout/activity_scrolling"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="@dimen/text_margin" 
     android:text="@string/large_text"/> 

</android.support.v4.widget.NestedScrollView> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_margin="@dimen/fab_margin" 
    app:layout_anchor="@id/main.framelayout.title" 
    app:layout_anchorGravity="top|end" 
    app:srcCompat="@android:drawable/ic_dialog_email"/> 

는 스크롤이 마지막으로 40 % 확대 정상에 도달하면 그 다음 높이이고의 이미지 뷰를 스크롤 할 때하는 것은 약 60 %를 확장한다는 것이다. 내가 원하는 것은 이미지 뷰가 부분적으로가 아니라 스크롤을 한 번 완전히 확장하는 것입니다. 다음은 그것을 설명하는 데 도움이되는 몇 가지 이미지입니다. 왼쪽 이미지는 정상적으로 위로 스크롤 할 때, 오른쪽 이미지는 마지막으로 위로 스크롤 할 때입니다.

enter image description here enter image description here

답변

1

나는 도구 모음의 부분 개방의 유사한 문제에 직면했다. scroll_flags 태그에 스냅을 추가했습니다. 이것이 당신이 묻고있는 것이기를 바랍니다.

<android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapsing_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      app:contentScrim="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">