android/view/view$on unhandled keyevent listener error

人走茶凉 提交于 2019-12-10 11:35:12

问题


When i create a new layout in Android Studio , I can't put anything on it literally (with root element android.support.v7.widget.Toolbar, by going layout->new->ressourse file)

I can't even change the background color! it shows me

"android/view/view$on unhandled keyevent listener"

the error is on the photo number 2


回答1:


I don't see anything underlined. Try the following


  1. Install the missing plattforms like Android Studio suggests in your screenshot from the comments

  2. Be sure to add implementation 'com.android.support:appcompat-v7:27.1.1' to your build.gradle

  3. If that doesn't work maybe it's just a rendering problem for the design preview. Therefore you can switch to another Theme right above the UI which says AppTheme.

Let me know if this helps




回答2:


//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
//noinspection GradleCompatible
implementation 'com.android.support:design:27.1.1'

add these two library hope this will work



来源:https://stackoverflow.com/questions/51433013/android-view-viewon-unhandled-keyevent-listener-error

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