alibaba / Tangram-Android

Tangram is a modular UI solution for building native page dynamically including Tangram for Android, Tangram for iOS and even backend CMS. This project provides the sdk on Android.

Home Page:http://tangram.pingguohe.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tangram可以和CollapsingToolbarLayout连用吗

CCCCauchy opened this issue · comments

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>

+1