0

こんにちは私はリサイクルビューをスクロールするとステータスバーがスクロールアップして奇妙な問題に遭遇しています。それ以外のすべては、それがそうであるように動作します。私は私のレイアウトが追加される方法だと信じていますが、どこに問題があるのか​​わかりません。アイデアがあればお知らせください。ありがとうございました!リサイクルビューでスクロールするステータスバー

CODE:

app_bar_main

<?xml version="1.0" encoding="utf-8"?> 
<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.application.app.Activity.MainActivity"> 

    <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:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:popupTheme="@style/AppTheme.PopupOverlay" 
      app:layout_scrollFlags="scroll|enterAlways" /> 

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

    <include layout="@layout/content_main" /> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|end" 
     android:layout_margin="@dimen/fab_margin" 
     app:srcCompat="@android:drawable/ic_dialog_email" /> 

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

content_main

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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:id="@+id/content_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="com.application.app.Activity.MainActivity" 
    tools:showIn="@layout/app_bar_main"> 

    <FrameLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/frame"> 

    </FrameLayout> 
</RelativeLayout> 

断片

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/recyclerView" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     /> 

</RelativeLayout> 
+1

'RelativeLayout'から' app:layout_behavior = "@ string/appbar_scrolling_view_behavior'を削除してみてください。 – nullbyte

+0

@vpaliyXはい、ありがとうございます。これもやってみましたが、断片的ではないでしょうか?実際の活動ですか? – paul590

答えて

1
<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/AppTheme.PopupOverlay"   
    app:layout_scrollFlags="scroll|enterAlways" /> 

最後のコード行は、ツールバーをスクロールアップさせます。しかし、あなたが「ステータスバー」と言ったので、これがあなたに役立つかどうかわかりません。 「ステータスバー」を上にスクロールする必要があるときは、アクティビティコードで行います。あなたのレイアウトでは動作しないかもしれません。

+0

ありがとう、それはツールバーをスクロールするだけでなく、ステータスバーにとどまるのではなく、ツールバーの内容を隠すことで変わります – paul590

関連する問題