Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does a greyed out view in the Android Layout Inspector mean?

In Android Studio, Tools -> Layout Inspector, what does a greyed out(subdued, dim) view in the View Tree mean? The layer still has VISIBLE properties

I don't see any explanation in the docs, https://developer.android.com/studio/debug/layout-inspector and there isn't a tooltip when hovering the view.

You can download the .li layout capture in question here


For context/reference, I am trying to figure out why the fragment isn't showing up in the id/content_container, https://gitlab.com/gitlab-org/gitter/gitter-android-app/issues/108

The project is open source if you want to check out the code yourself, https://gitlab.com/gitlab-org/gitter/gitter-android-app

like image 249
MLM Avatar asked Jan 27 '23 00:01

MLM


2 Answers

The grayed-out Views are not rendered at the time when the LayoutInspector snapshot is taken because they don't need to be shown.

Examples:

  • the NavigationView in your code is currently hidden (you can test if I'm right by opening it and taking another snapshot with LayoutInspector)
  • the RecyclerView in the NavigationView is grayed-out as long as it has no Adapter assigned to it (and maybe also if it is empty - did not test it)
  • sometimes Views don't fit on the screen, like when you forget to make a LinearLayout "vertical" and so most of its children are to the right of the right screen edge
like image 176
Bö macht Blau Avatar answered Jan 31 '23 19:01

Bö macht Blau


these nodes are boilerplate layout, which are essential for the framework.

that ContentFrameLayout is the root-view with id android.R.id.content,

which has R.layout.activity_main inflated and it adds further nested nodes into there.

basicallyy it's name-space android.R (in gray) vs. im.gitter.gitter.R (in black).

nodes from android.R might still turn black, when they have a visble layout inflated.

like image 32
Martin Zeitler Avatar answered Jan 31 '23 20:01

Martin Zeitler