非法參數(shù)異常,遇到的問題是:
ScrollView里面有RecyclerView怜姿,RecyclerView里的item有EditText,我是在這個(gè)頁面在后臺(tái)的時(shí)候,因?yàn)閿?shù)據(jù)發(fā)生了變化蚕钦,讓頁面刷新了,比如adapter.notifyDataSetChanged();
鹅很,因獲取焦點(diǎn)產(chǎn)生的問題
java.lang.IllegalArgumentException: parameter must be a descendant of this view
at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:5103)
at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:5040)
at android.widget.ScrollView.isWithinDeltaOfScreen(ScrollView.java:1140)
at android.widget.ScrollView.onSizeChanged(ScrollView.java:1543)
at android.view.View.sizeChange(View.java:15843)
at android.view.View.setFrame(View.java:15808)
at android.view.View.layout(View.java:15724)
解決辦法:
給這個(gè)頁面的其他什么東西,比如頂層view設(shè)置上
android:focusable="true"
android:focusableInTouchMode="true"
這樣item里的EditText不會(huì)獲取焦點(diǎn)就ok了嘶居。