私は現在、Android 6用のJavaで書かれたスクール用のグレードマネージャーに取り組んでいます。Android RecyclerビューnotifyItemRemovedアニメーションを切断しました
問題:
私は右上の場所に私のRecycleViewアダプタと左下の場所からの最後のCardViewの移動の方法notifyItemRemoved()
を呼び出すと、ビューのサイズが変更され、アニメーションがカットされます。
今、RecycleViewのlayout_height
属性がmatch_parent
であるため、そのビューのサイズが変更された理由がわかりません。
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".SemesterActivity"
tools:showIn="@layout/activity_semester">
<android.support.v7.widget.RecyclerView
android:id="@+id/subject_list_view"
android:padding="20dp"
android:layout_below="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"/>
</android.support.v4.widget.NestedScrollView>
私はRecycleViewのためのLayoutManagerとしてGridLayoutManager
を取りました。
SubjectAdapterObj.notifyItemRemoved(viewHolder.getAdapterPosition());
アニメーションは、デフォルトのアニメーションです:私はRecycleViewを更新方法
subjectListView.setLayoutManager(new GridLayoutManager(ActivityContext, 2));
。
GridLayoutManager
は問題ですか?
ビデオ例:
申し訳ありません。英語は母国語ではありません。
使用しているrecyclerviewのバージョンは何ですか? – Abbas
recycleview-v7-23.4.0それはどういう意味ですか? – Velrest
'RecyclerView'の' onMeasure'をオーバーライドし、max-heightを設定してみてください。 – Abbas