出现下列错误:
java.lang.IllegalStateException: Could not find method onClick(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatImageView with id 'iv_search_single'
出现的原因:
1、父控件和子控件的onClick冲突;
2、viewgroup的事件分发机制
解决:
1、将父控件的onClick删除,只保留子控件的onClick
2、将父控件设置为: android:clickable="true"