Could not find a method onClick(View) in the activity class TintContextWrapper for onClick if using themes

醉酒当歌 提交于 2019-12-05 01:24:38

Change android.support.v7.widget.AppCompatButton to Button.

It will work for u.

Other way.

You can use setOnClickListener in Your Activity for Click event.

For me magically worked setCompatVectorFromResourcesEnabled(true); like this:

@Override
protected void onCreate(Bundle savedInstanceState) {
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    super.onCreate(savedInstanceState);
    ...
}

Actually, it should be called only once and this could be done in Application class, not necessarily in Activity.

Honestly, I had this code line for other reasons but when tried to remove it, I got exactly this bug with onClick. So I put this line back and wow! Like a charm.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!