Bassam A.

    Bassam A.

    5 months ago
    Does anyone know why my preview, does not look like the emulator? (I’ve restarted it so many times).
    g

    Guilherme Cordeiro

    5 months ago
    Is it possible that the view or viewgroup you are displaying receives some properties from a theme or style? Or that the initialization of it happens programmatically?
    if it uses a theme or style, maybe you just have to change it on your layout inspector attributes (the top bar on the "design" tab)
    Also, if it is a custom view compiled in another module, the layout inspector may run into trouble finding all the custom attributes during the preview
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    5 months ago
    It looks like the preview is passing fixed constraints down (e.g.
    fillMaxSize
    ), but whatever is hosting your composable in your app is not. For this sort of component, you probably don’t need the full device frame decoration in the preview, so you can turn that off then the preview should just let your component be whatever size it wants. But if you do want the frame decoration, then in your preview apply the
    wrapContentSize
    modifier to your composable.
    Chris Sinco [G]

    Chris Sinco [G]

    5 months ago
    Also please provide the code for your Preview function, as that can help us debug
    Also, if you're using Bumblebee there is a bad caching bug that can be fixed by closing and reopening the Compose file with the Preview that doesn't seem to update
    Bassam A.

    Bassam A.

    5 months ago
    Thanks @Zach Klippenstein (he/him) [MOD]
    wrapContentSize
    solved the issue.
    @Chris Sinco [G] I understand your point, I tried several times before I submit it here.
    @Guilherme Cordeiro Thanks for the participation, I am adapting compose in this project, and the solution to add
    wrapContentSize
    modifier.