I have a strange Error with a ViewGroup. For my main View I use classes in this links ViewFlow project
java.lang.IllegalArgumentException: parameter must be
I had the same issue when deleting item from recycler view which contains EditText. Just before notifying adapter that item was deleted I used
(requireContext() as Activity).currentFocus?.clearFocus()
Solved my problem with adding scroll listener.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View currentFocus = ((Activity)mContext).getCurrentFocus();
if (currentFocus != null) {
currentFocus.clearFocus();
}
}
This works for me.
convertView = mInflater.inflate(R.layout.row_stat_header,
parent, false);
Here, parent
is the ViewGroup parameter in the getView.
Have the same problem. I use a ViewFlow as the parent view and several GridView as child views.This error happens when I press the Home key and restart the activity again after I scrolled these child views left and right.
Here is my solution:
mViewFlow.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
Of course, you can config it in layout.xml.
Hope that can help you.