2016-10-10 1 views
0

Wenn das Layout Formulare alles ist in Ordnung, wie in Bild aus Statusleiste und Statusleiste Farbe ist transparent gebildet. Aber wenn ich nach oben scrolle und dann in der Recycler-Ansicht nach unten scrolle, scrollt das Bild bis unter die Statusleiste. Aber wenn ich auf das Bild klicke, nimmt es die ursprüngliche Position ein.Collapsing Toolbar Bild unter Statusleiste auf Recyclerview scrollen nach unten

-Code für Art/v21

<style name="AppTheme.NoActionBar"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
    <item name="android:windowDrawsSystemBarBackgrounds">true</item> 
    <item name="android:statusBarColor">@android:color/transparent</item> 
    <item name="android:windowIsTranslucent">true</item> 
</style> 
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
    <item name="android:windowContentTransitions">true</item> 
    <item name="android:statusBarColor">@android:color/transparent</item> 
    <item name="android:windowIsTranslucent">true</item> 
</style> 

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" > 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
    <item name="android:statusBarColor">@android:color/transparent</item> 
    <item name="android:windowIsTranslucent">true</item> 
</style> 
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
    <item name="android:statusBarColor">@android:color/transparent</item> 
    <item name="android:windowIsTranslucent">true</item> 
</style> 

-Code für Symbolleiste Layout kollabiert.

<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.ashish.swipemusic.GenreDetails"> 



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

     <ImageView 
      android:id="@+id/headerArtist" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      android:scaleType="fitXY" 
      android:src="@drawable/album_details1" 
      /> 

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

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

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

<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" 
    android:src="@drawable/ic_play_arrow_black_24dp" 
    app:layout_anchor="@id/app_bar" 
    app:layout_anchorGravity="bottom|end" /> 
<android.support.v7.widget.RecyclerView 
    android:id="@+id/genre_songs_recyclerview" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:scrollbars="vertical" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    > 

</android.support.v7.widget.RecyclerView> 

before scroll

after scroll down status bar appears

Antwort

0

Versuchen Sie app:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed" in Ihrem Toolbar zu entfernen? Ich habe es auf diese Weise versucht und es funktioniert ziemlich gut

Verwandte Themen