android-studioattributescardview

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


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.

screen shot of Android Studio


Solution

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

    Restarting Android Studio was the solution for me.