Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Tangram可以和CollapsingToolbarLayout连用吗 #188

Open
CCCCauchy opened this issue Mar 23, 2020 · 1 comment
Open

Tangram可以和CollapsingToolbarLayout连用吗 #188

CCCCauchy opened this issue Mar 23, 2020 · 1 comment

Comments

@CCCCauchy
Copy link

1、需求来源:实现类似淘宝首页底部多tab推荐样式
2、实现思路:将RecyclerView放入CollapsingToolbarLayout中,收缩Tangram加载的内容
3、问题:RecyclerView在onMeasure后的高度始终为0。ps:使用GridLayoutManager和adapter的方式加载RecyclerView是可以正常显示的。

   <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <com.google.android.material.appbar.CollapsingToolbarLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_scrollFlags="scroll|exitUntilCollapsed"
                app:statusBarScrim="@android:color/white">

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rv_home_tangram"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />

            </com.google.android.material.appbar.CollapsingToolbarLayout>

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/tl_home_recommend"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:tabMode="scrollable" />

        </com.google.android.material.appbar.AppBarLayout>

        <androidx.viewpager.widget.ViewPager
            android:id="@+id/vp_home_recommend"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    </androidx.coordinatorlayout.widget.CoordinatorLayout>
@whstywh
Copy link

whstywh commented Nov 4, 2020

+1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants