Appcompat "java.lang.IllegalArgumentException: parameter must be a descendant of this view" in ViewGroup.offsetRectBetweenParentAndChild Appcompat "java.lang.IllegalArgumentException: parameter must be a descendant of this view" in ViewGroup.offsetRectBetweenParentAndChild android android

Appcompat "java.lang.IllegalArgumentException: parameter must be a descendant of this view" in ViewGroup.offsetRectBetweenParentAndChild


You should try the following in XML:

android:descendantFocusability="beforeDescendants"


usually on ListView there is method named offsetRectBetweenParentAndChild() that has the job of recycling views on scroll and this method usually throws this exception.

the best answer to this question is

Append a ScrollListener to your Activity, when listView start scrolling, clear current focus.

which I found in this question.

please check it out and let me know if there is other issues.


Have you tried setting Focusability on your View correctly?:

mYourView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);

or in XML

android:descendantFocusability="blocksDescendants"