Android Studio: Component is selected but Attributes editor says “No component selected”

女生的网名这么多〃 提交于 2021-02-08 04:00:52

问题


TL;DR: Although I can edit component attributes directly in XML (sanity check — I'm sane) the Attributes inspector pane claims nothing is selected. I.e. "It doesn't work."

I added a CardView to the main layout. It does show up in the Component Tree and in the Design Editor. I select the CardView in the Component Tree pane, but the Attributes pane says "No component selected".

I'm using Android Studio 3.5.2 on MacOS 10.15.1. This happens with all three CardViews (see screenshot).

Clicking the Text tab shows the XML for all the components, including the (so-called) "non-selected" one. Direct edits I make on the CardView XML entity do have effect, and the app builds and runs correctly, with all three CardViews showing up and scrolling in the ScrollView. So this is probably not a gradle issue (thanks autocorrect, it's not a cradle problem either). It's more like the build process knows about the views, but not the edit process.

I re-created the project from scratch, with the same result.


回答1:


I had the same problem today with a FloatingActionButton in Android Studio on macOS.

Restarting Android Studio was the solution for me.



来源:https://stackoverflow.com/questions/59221913/android-studio-component-is-selected-but-attributes-editor-says-no-component-s

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