I'm currently working on a Grade Manager for school written in Java for Android 6. I just started with Android so I'm no expert.
The Problem:
If I call the method
notifyItemRemoved()
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>
GridLayoutManager
subjectListView.setLayoutManager(new GridLayoutManager(ActivityContext, 2));
SubjectAdapterObj.notifyItemRemoved(viewHolder.getAdapterPosition());
GridLayoutManager
So I finally found out what the Problem was.
It actually was the NestedScrollView which resizes it's children.
So what you need to do is simply add android:fillViewport="true"
to your NestedScrollView.
Thats it. I hope it helps someone although it's not a really difficult bug. I just searched at the wrong places.