h6ah4i/android-advancedrecyclerview

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

Open

#394 geöffnet am 5. Juni 2017

Auf GitHub ansehen
 (5 Kommentare) (0 Reaktionen) (1 zugewiesene Person)Java (879 Forks)batch import
help wantedquestion

Repository-Metriken

Stars
 (5.296 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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

Contributor Guide