Java Android回收器视图notifyItemRemoved动画关闭
我目前正在为学校做一名年级经理,用Java为Android 6编写。我刚开始使用Android,所以我不是专家 问题:Java Android回收器视图notifyItemRemoved动画关闭,java,android,xml,animation,android-6.0-marshmallow,Java,Android,Xml,Animation,Android 6.0 Marshmallow,我目前正在为学校做一名年级经理,用Java为Android 6编写。我刚开始使用Android,所以我不是专家 问题: 如果在我的RecycleView适配器上调用方法notifyItemRemoved(),并且最后一个CardView从左下角移动到右上角,则视图的大小将调整,动画将被剪切 现在我不知道为什么要调整视图的大小,因为RecycleView的layout\u height属性是match\u parent <?xml version="1.0" encoding="utf-8"
如果在我的RecycleView适配器上调用方法
notifyItemRemoved()
,并且最后一个CardView从左下角移动到右上角,则视图的大小将调整,动画将被剪切
现在我不知道为什么要调整视图的大小,因为RecycleView的layout\u height
属性是match\u 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:
SubjectAdapterObj.notifyItemRemoved(viewHolder.getAdapterPosition());
动画是默认动画
GridLayoutManager
可能是问题所在吗
视频示例:
对不起。英语不是我的母语。所以我终于发现了问题所在。
实际上是
NestedScrollView
调整了其子对象的大小。因此,您需要做的只是将
android:fillViewport=“true”
添加到您的NestedScrollView
就这样。我希望它能帮助一些人,虽然这不是一个真正困难的错误。我只是在错误的地方搜索了一下。你使用的recyclerview版本是什么?recyclerview-v7-23.4.0这就是你的意思吗?尝试覆盖
的测量并设置max-height。同时检查视图中是否有父视图具有height=“wrap\u content”@阿巴斯如果我试图覆盖RecyclerView,我总是会得到:android.view.InflateException:Binary XML文件行#65:Binary XML文件行#11:Error inflating class
SubjectAdapterObj.notifyItemRemoved(viewHolder.getAdapterPosition());