Reputation: 3547
Here is my main layout
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:elevation="4dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
app:titleTextAppearance="@style/ToolbarTitle"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|enterAlways|snap"/>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
style="@style/CustomTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="scrollable"
app:layout_scrollFlags="enterAlways"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" >
</FrameLayout>
<fr.castorflex.android.circularprogressbar.CircularProgressBar
android:id="@+id/base_progressSpinner"
android:layout_gravity="center"
android:layout_width="72dp"
android:layout_height="72dp"
android:indeterminate="true"
android:visibility="invisible"
app:cpb_color="@color/spinner"
app:cpb_rotation_speed="1.0"
app:cpb_sweep_speed="1.0"
app:cpb_stroke_width="4dp"
app:cpb_min_sweep_angle="10"
app:cpb_max_sweep_angle="300"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_request"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="bottom|end"
android:src="@drawable/request_fab_icon"
android:layout_margin="@dimen/big_padding"
android:clickable="true"
app:backgroundTint="@color/fab"
app:layout_anchorGravity="bottom|right|end"
app:layout_behavior="source.bigdx.com.bigdxsource.util.ScrollAwareFABBehavior"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_contact"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="end|bottom"
app:borderWidth="0dp"
android:src="@drawable/contact_fab_icon"
android:layout_margin="@dimen/big_padding"
android:clickable="true"
app:backgroundTint="@color/fab"/>
</android.support.design.widget.CoordinatorLayout>
On API 16 and up there is no issue. When content is scrolled the toolbar shifts up until collapsed like it should.
However on API 14/15 when scrolled the content does not scroll, only the toolbar. when toolbar is collapsed the content then scrolls but will not overlap where the toolbar was.
I have tried changing many things like styles and values in layout above but can't make it work like it does on API 16+ devices.
Update
It seems wrapping it in a CollapsingToolbarLayout fixes it but shouldn't be needed.
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways|snap"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
app:titleTextAppearance="@style/ToolbarTitle"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
style="@style/CustomTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="scrollable"
app:layout_scrollFlags="enterAlways"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
Upvotes: 0
Views: 333
Reputation: 209
It is the problem with CoordinatorLayout in ICS. Try using different Layout and the toolbar will show up
Upvotes: 1