2016-06-19 8 views
3

編集:タブレットgfycatリンクが更新されました。折りたたみツールバーのツールバーが固定されていません

私の電話レイアウトに問題があります。私はツールバーにapp:layout_collapseMode = "pin"を設定していますが、画面からスクロールします。また、古典的な「スライド」モーションも無効になっているようです。

電話レイアウト: https://gfycat.com/EnviousPaleFlicker

タブレットレイアウト: https://gfycat.com/QueasyPowerlessGrayfox

ここでは詳細な活性および詳細断片の両方によって膨張されたレイアウトです。

movie_detail.xml:

<android.support.design.widget.CoordinatorLayout 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" 
    android:fitsSystemWindows="true" 
    tools:context="com.example.bunny.popularmoviesapp.MovieDetailActivity"> 

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

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

      <!--alpha here to help make text readable over image--> 
      <ImageView 
       android:id="@+id/backdrop_container" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:scaleType="centerCrop" 
       android:alpha="0.6" 
       app:layout_collapseMode="parallax" 
       android:adjustViewBounds="true"/> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/detail_toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       app:layout_collapseMode="pin" 
       app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 
     </android.support.design.widget.CollapsingToolbarLayout> 

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

    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 
     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:tools="http://schemas.android.com/tools" 
       android:id="@+id/movie_detail" 
       style="?android:attr/textAppearanceLarge" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:gravity="center" 
       android:padding="16dp" 
       android:textIsSelectable="true" 
       tools:context="com.example.bunny.popularmoviesapp.MovieDetailFragment" /> 

      <TextView 
       android:id="@+id/overview_text" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:padding="@dimen/text_margin" 
       android:layout_below="@id/movie_detail" /> 
     </LinearLayout> 
    </android.support.v4.widget.NestedScrollView> 
</android.support.design.widget.CoordinatorLayout> 

答えて

4

は、これらを使用してAppBarLayoutとCollapsingToolbarLayoutオープニングタグを取り付け、

<android.support.design.widget.AppBarLayout 
    android:id="@+id/app_bar" 
    android:layout_width="match_parent" 
    android:layout_height="@dimen/app_bar_height" 
    android:fitsSystemWindows="true" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

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

は、これは私の問題を修正しました。ありがとうございました!私は、スクロールフラグとfitsSystemWindowsについて詳しく調べます。 –

関連する問題