问题
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
Install the missing plattforms like
Android Studio
suggests in your screenshot from the commentsBe sure to add
implementation 'com.android.support:appcompat-v7:27.1.1'
to yourbuild.gradle
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 saysAppTheme
.
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