1

更新:ここではexample appです。 Nexus 6P、Android 6.0.1でテストしました半透明ナビゲーションがtrueの場合、AppBarLayoutのツールバーはスクロールしません。

私はCoordinatorLayoutRecyclerViewを使用しています。 <item name="android:windowTranslucentNavigation">true</item>ツールバーが隠れていない場合(ただし、スクロール可能です) 23.2.1

<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"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:layout_height="wrap_content" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      app:layout_scrollFlags="scroll|enterAlways" 
      app:popupTheme="@style/AppTheme.PopupOverlay" /> 

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

    <android.support.v7.widget.RecyclerView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

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

私はAppBarLayoutandroid:fitsSystemWindows="true"を追加した場合、それはいくつかの問題で動作します:APPCOMPATはV7です。

解決策はありますか?

システムバーオーバーレイツールバー enter image description here

上部と下部パディングは、ツールバー enter image description here

+0

問題の解決方法を見つけることができますか? – atabek

答えて

1

enter image description here

CoordinatorLayout(多分)巻物があり、これはバグであるようです。問題の一時的な解決策を見つけました。 fitsSystemWindowsコーディネーターレイアウトとその子供の、またはにそれらを設定します。

はすべてアンドロイドを取り除きます。ステータスバーの高さを取得するために

toolbar.setPadding(0, getStatusBarHeight(), 0, 0); 
toolbar.getLayoutParams().height = toolbar.getLayoutParams().height + getStatusBarHeight(); 

方法:そして、あなたの活動に手動でツールバーの高さとトップパディングにステータスバーの高さを追加し、これらの変更により

public int getStatusBarHeight() { 
    int height = 0; 
    int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); 
    if (resourceId > 0) { 
     height = getResources().getDimensionPixelSize(resourceId); 
    } 
    return height; 
} 

、ツールバーが適切にスクロールされて、それは適切な高さを持っています。

関連する問題