Stacklayout inside a Scrollview

Hi,

I have one stack layout inside scrollview. At run time, i am adding item to stack layout. When i am adding 1st time to stack layout, it's takes 100% height and there is no scroll. After adding 2nd item, both item takes 50% height each and still there is no scroll. Again when i add 3rd item, each takes equal height (i.e. almost 33%) but no scoll yet.

I have set VerticalOptions for scrollview and stack layout.

VerticalOptions = LayoutOptions.FillAndExpand

Do i need to set a fixed height to each item while adding it to stack layout, because i need a scroll when item increases ?
Please let me know.

Answers

  • PrasadCPPrasadCP USMember ✭✭

    Yes Set Fixed Height To each item you are adding.

  • batmacibatmaci DEMember ✭✭✭✭✭

    Have you found a better solution for this? Because setting fix Height is never a good solution as there are many devices with different screen sizes.

  • JohnHardmanJohnHardman GBUniversity mod

    @DeveshMishra - It's not clear what you want the result to be. However, you probably want to:

    Set VerticalOptions to Start for the items that you add to the StackLayout
    Set VerticalOptions to FillAndExpand for the StackLayout
    Set VerticalOptions to Fill for the ScrollView

  • DeveshMishraDeveshMishra USMember ✭✭

    @batmaci said:
    Have you found a better solution for this? Because setting fix Height is never a good solution as there are many devices with different screen sizes.

    No. I know setting fixed height is not a good solution, specially in mobile application.
    If u can calculate height at run time of parent container in which you are adding children, then i think it can solve the problem.

Sign In or Register to comment.