Can I access individual composed items in Layout M...
# android-studio
m
Can I access individual composed items in Layout Manager? When using xml each screen artifact can be located and its properties viewed, but I can only see a top level composable. Surely that's not right? (Flamingo Patch 2)
c
Hmm do you mean Layout Inspector? Screenshots would help as well to debug
m
Err, oops, yes, Layout Inspector
Screenshot, really? Ok, here it is. The smallest composable unit I can get info for is ListTest. That's my main composable function but I want to know the calculated layouts of all the constituents. My immediate concern is (as a noob) I don't how to layout the main elements (eg "Cadora Inc") so that they don't have large gaps between them and when I click the arrow to expand its list of sub-elements they don't cover the main element
c
I see. What I’m told is happening here from internal folks is that Layout Inspector is reading every instance of “ListTest” as the same draw ID, so it’s only showing one. This would be like showing only one instance of a list item template, assuming it’s reused. So you are reusing the ListTests function as a list item?
Having the code that is generating this hierarchy would also be useful
m
Thanks for this @Chris Sinco [G]. Here are the two files with the composables. My first foray into the composable world. ListTest is the top level composable. I don't think it's working in a way that could be described by "reusing". I was going to explain the picture, but I expect the code is a better explanation. Tell me if anything is not obvious.
c
Thanks! A couple follow-up questions: 1. In the Layout Inspector, do you have the view option “Filter System-Defined Layers” enabled? We have some bug reports of that hiding Composables unintentionally, so please try to toggle it on/off and see if that does anything 2. I see an annotation for
ExperimentalMultiplatform::class
- could you elaborate on the usage?
Also, I think having more of the project will be useful (if you can share) since it looks like you are mixing Views and Compose, which could be causing issues with the inspector that we don’t know about
m
Thanks for that. It seems that "Filter System-Defined Layers" is the thing that's causing the problem. When disabled I can see all the elements. I've toggled it a few times and every time when it's on the whole composable becomes one opaque element. I'm not certain where the annotation you refer to comes from. It seems to be required by my implementation of a Parcelize class for this multiplatform project. Yes, I have views and composables. This is a single activity/multi-fragment project that I'm just starting to convert to using (multiplatform) compose. This is the first screen I'm working on. If it's of any use to you(s) to see more of the project pm me and I can arrange for guest access to the repo.
c
Thank you! That does sound like the bug, but if we can get the project to repro on our end that would be helpful. I’ll PM you.