Scrolling View with Multiple Elements

  1. 3 years ago


    13 Aug 2019 User since 2018


    I've got a view that basically contains a title, subtitle and some text that could be very long. I would like the whole view to be scrollable, not just the TextView that is long so the experience is smooth.

    How should I do this?


  2. andrea

    15 Aug 2019 Administrator User since 2016
    Edited 3 years ago by andrea

    Hi @ingurgite,
    you could use a container View with the flex layout engine enabled and with the Auto Content Size property set to the Flex value. Then put three Label controls inside the container View, one for the title, one for the subtitle and one with the multiline option flagged for the long text; each one with flex enabled. The content size of the container View will automatically adjust with the space needed by the three inner controls. Just adjust the padding and the margin from the flex inspector of the controls.
    Please see the attached example:

    Screenshot 2019-08-15 at 11.02.40.png
    Screenshot 2019-08-15 at 11.02.47.png

  3. ingurgite

    31 Aug 2019 User since 2018

    Works great @andrea. Thanks for having taken the time to create an example. I wasn't familiar with Flex.

    As a side note though, I discovered that fonts behave very differently and I don't think this is normal. Please see attached the same kind of example where the content text is in Helvetica Neue. If you change it to Helvetica, it creates a huge padding on top of the text. I don't think this is normal. See screenshots below.

or Sign Up to reply!