I have an own implementation of the scrolling toolbar in my app. In the new design library from Google http://android-developers.blogspot.de/2015/05/android-design-support-library.html there is a new implementation for scrolling the toolbar. Thats very nice and easy to implement but my problem is there is some limitation. I have a Toolbar and behind there is an image and a tabstrip at the bottom. If i use the new implementation i cant get the toolbar with the image scroll off and the tabstrip dont disappear. I can get the tabstrip under the toolbar with the image but thats not my goal.
In the left thats the way it works correctly but the tabstrip isnt on top of the image. On the right it is correct but the tabstrip disappear if it scrolls
I hope it is clear what i mean and someone can help me, thank you.
I forget the xml declarations. Left screenshot:
<android.support.design.widget.CoordinatorLayout
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.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<WebView
android:id="@+id/wvTest"
android:layout_height="match_parent"
android:layout_width="match_parent"/>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.AppBarLayout
android:id="@+id/abTest"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp"
app:layout_scrollFlags="scroll|enterAlways">
<ImageView
android:id="@+id/ivMainImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/background" />
<View
android:id="@+id/vActionBarBackgroundHolder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#37913C"
android:alpha="0" />
<android.support.v7.widget.Toolbar
android:id="@+id/tbTest"
android:layout_width="match_parent"
android:background="#00FFFFFF"
android:layout_height="65dp" />
</RelativeLayout>
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#37913C"/>
</android.support.design.widget.AppBarLayout>
Right Screenshot:
<android.support.design.widget.CoordinatorLayout
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.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<WebView
android:id="@+id/wvTest"
android:layout_height="match_parent"
android:layout_width="match_parent"/>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.AppBarLayout
android:id="@+id/abTest"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp"
app:layout_scrollFlags="scroll|enterAlways">
<ImageView
android:id="@+id/ivMainImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/background" />
<View
android:id="@+id/vActionBarBackgroundHolder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#37913C"
android:alpha="0" />
<android.support.v7.widget.Toolbar
android:id="@+id/tbTest"
android:layout_width="match_parent"
android:background="#00FFFFFF"
android:layout_height="65dp" />
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#8837913C"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</android.support.design.widget.AppBarLayout>