2016-06-19 13 views
3

BEARBEITEN: Die gfycat-Verbindung für Tablets wurde aktualisiert.Symbolleiste in minimaler Symbolleiste Layout wird nicht fixiert

Ich habe ein Problem mit meinem Telefonlayout. Obwohl ich app: layout_collapseMode = "pin" auf meiner Symbolleiste eingestellt habe, scrollt es direkt neben dem Bildschirm, zusätzlich scheint auch die klassische 'Slide' Bewegung deaktiviert zu sein.

Telefon Layout: https://gfycat.com/EnviousPaleFlicker

Tablet Layout: https://gfycat.com/QueasyPowerlessGrayfox

Hier wird das Layout sowohl Aktivität Detail aufgeblasen wird und das Detail-Fragment.

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> 

Antwort

4

Ersetzen Sie Ihre AppBarLayout und CollapsingToolbarLayout Öffnung Tags mit diesen

<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

Das ist mein Problem behoben. Vielen Dank! Ich werde tiefer in Scroll-Flags eintauchen und zu SystemWindows passen. –

Verwandte Themen