Android listview show all items without scroll

listview inside scrollview

Archived Forums
>
Xamarin.Android
  • Question

  • 0
    Sign in to vote
    User141765 posted

    Hi,

    I have created listview inside scrollview and all work right, the listview has it's scroll and work fine, the problem is that listview display only the First item, if i want to see others items i must scroll listview.

    How can i display all listview's items without scroll? Thanks.

All replies

  • 0
    Sign in to vote
    User103165 posted

    You should not use a ListView inside a ScrollView. A ListView will scroll by itself.

  • 0
    Sign in to vote
    User141765 posted

    Yes i know but i used scrollview because the Page has listview and others Controls, if i don't use scrollview how can make Page scrollable?

    Thanks.

  • 0
    Sign in to vote
    User98607 posted

    @eljallouly Try this, works well.

    ...Other Items...
  • 0
    Sign in to vote
    User141765 posted

    Thanks for your response, the listview inside your code can i create it dynamiclly?

  • 0
    Sign in to vote
    User98607 posted

    Sure, create an adapter for list view and add some data in activity, then set adapter for list view.

    This line will prevent any focusing problem for list view

    android:descendantFocusability="blocksDescendants"
  • 0
    Sign in to vote
    User141765 posted

    isn't working, this is my code:

    ============================================

    ListView li = new ListView[this];

    li.Adapter = new ArrayAdapter[this, Android.Resource.Layout.SimpleListItemMultipleChoice, item.Fields[i].PoolList.ToArray[]]; li.DescendantFocusability = DescendantFocusability.BlockDescendants; li.VerticalScrollBarEnabled = false; li.SetMinimumHeight[300];
  • 0
    Sign in to vote
    User98607 posted

    @eljallouly I assure you that xml code is working fine and it's been using for a production code for months.

    You don't need to use

    li.DescendantFocusability = DescendantFocusability.BlockDescendants;

    and li.SetMinimumHeight[300];

    Did you change anything on xml code that I shared ?

Video liên quan

Chủ Đề