Disable scroll ListView android

Is there a solution to disable inner scrolling of Listview within a Scrollview?

Archived Forums
>
Xamarin.Forms
  • Question

  • Disable scroll ListView android
    Disable scroll ListView android
    0
    Sign in to vote
    User395928 posted

    Here is the layout I want to achieve:

    I would like to scroll the entire screen instead of the listview.

    I know bindable stacklayout is a good alternative as listview, but since I have to show group data, I didn't manage to make it work with bindable stacklayout.

    What I tried but didn't work: Try 1: Put the listview and a boxview in the same grid. It did disable scrolling, but the listview won't be able to show full data in itemsource. It only shows the size of the screen.

    Try 2 - custom renderer: https://riptutorial.com/xamarin-forms/example/10022/custom-renderer-for-listview

    neither ios nor android is working....

    I found this post mentioned: listView.HeightRequest = listView.RowHeight * ((Your List that you want to show in ListView).Count + 1);

    But seems like I can only get the count of item(it will be dynamic) in viewmodel, then how to set listview's height?

    So I think the best solution is still to disable to scroll of listview. Is there a workaround?

Answers

  • Disable scroll ListView android
    Disable scroll ListView android
    0
    Sign in to vote
    User371688 posted

    I think you could place your top controls in the ListView's header, then it can be scrolled with the list view's items.

    For example:

    ```

    ```

    For more about this, you can check: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/listview/customizing-list-appearance#headers-and-footers

    • Marked as answer by

All replies

  • Disable scroll ListView android
    Disable scroll ListView android
    0
    Sign in to vote
    User371688 posted

    I think you could place your top controls in the ListView's header, then it can be scrolled with the list view's items.

    For example:

    ```

    ```

    For more about this, you can check: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/listview/customizing-list-appearance#headers-and-footers

    • Marked as answer by
  • Disable scroll ListView android
    Disable scroll ListView android
    0
    Sign in to vote
    User371688 posted

    And there is an article about this, you can check it here:ListView Inside ScrollView Xamarin.Forms WorkAround

  • Disable scroll ListView android
    Disable scroll ListView android
    0
    Sign in to vote
    User395928 posted

    @jezh Thank you so much. There are trade-offs but save my life o:)