Flexible CollapsingToolbarLayout height in SmoothViewPagerParallaxExitUntilCollapsedActivity
dan-huang opened this issue · 8 comments
Using the demo SmoothViewPagerParallaxExitUntilCollapsedActivity, I want to set CollapsingToolbarLayout height to: wrap_content. And add a textView with flexible height. Here I set the height to 100dp.
But there is a 156dp gap between TabLayout And RecycleView in ViewPager. How to avoid the gap or overlap when CollapsingToolbarLayout is not 256dp height?
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<me.henrytao.smoothappbarlayout.SmoothAppBarLayout
android:id="@+id/smooth_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/mdSecondaryActionBarSize">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:text="@string/text_long"/>
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</me.henrytao.smoothappbarlayout.SmoothAppBarLayout>
</android.support.design.widget.CoordinatorLayout>
Hi @dan-huang,
Please try to set @dimen/mdSecondaryActionBarSize
to 100dp
. I hope it helps.
Cheers,
Henry
Hi @henrytao-me ,
Tried but the gap is still there..
Hi @dan-huang,
I see what you mean. flexible height
won't work. With SmoothAppBarLayout, you have to know height a head of time in order to maintain proper padding in scroll view. It's a trade off comparing to AppBarLayout. Sorry about not being helpful in this scenario.
Cheers,
Henry
Thanks anyway, @henrytao-me.
Is it possible to try it out myself base on smooth-app-bar-layout?
Hi @dan-huang
I don't get what you mean Is it possible to try it out myself base on smooth-app-bar-layout?
?
I heard around that there is a fixed for flinging issue of AppBarLayout in upcoming release. I am still waiting for it. That's why I postpone to improve SmoothAppBarLayout.
Hi @henrytao-me
I mean, When SmoothAppBarLayout height changed, each scrollView in ViewPager change it's padding accordingly.
Looking forward to the upcoming release.
Technically, it's possible. However, it requires a lot of works in java code. Maybe you need to have some sort of event bus to synchronize height or some static variables or some custom callbacks.
Thanks a lot.~ I'll try.