h6ah4i/android-advancedrecyclerview

recyclerView shrinks when using "targetSdkVersion >22" but works fine when using "targetSdkVersion 22"

Open

#394 创建于 2017年6月5日

在 GitHub 查看
 (5 评论) (0 反应) (1 负责人)Java (5,296 star) (879 fork)batch import
help wantedquestion

描述

In the advancedrecyclerview sample app, the recyclerView shrinks if any view above the recyclerView renders after the recyclerView is rendered

Setup: targetSdkVersion 23 or 24 or 25

changes in fragment_recycler_list_view.xml as

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    android:overScrollMode="never"
    android:scrollbars="none">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:animateLayoutChanges="true"
        android:clipChildren="false"
        android:gravity="center_horizontal"
        android:orientation="vertical"
        android:overScrollMode="never">

        <View
            android:id="@+id/view_dummy"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:background="@color/bg_swipe_group_item_pinned"
            android:visibility="gone" />

        <android.support.v7.widget.RecyclerView
            android:id="@+id/recycler_view"
            style="@style/myRecyclerViewStyle"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </LinearLayout>
</ScrollView>

changes in ExpandableDraggableSwipeableExampleFragment.java as

        final View dummyView = getView().findViewById(R.id.view_dummy);
        mRecyclerViewExpandableItemManager.setDefaultGroupsExpandedState(true);
        mRecyclerView.setNestedScrollingEnabled(false);
        mRecyclerView.postDelayed(new Runnable() {
            @Override
            public void run() {
                dummyView.setVisibility(View.VISIBLE);
            }
        }, 2000);

after initializing the RecyclerViewExpandableItemManager.

But the same setup works fine with targetSdkVersion 22

贡献者指南