Android listview not scrollable

AnasGuibene asked May 11, '21 | AnasGuibene answered May 21, '21

How to fix Listview not reaching the last item when scrolling

Hello, I have a listview that contains messages (refresh every 5 seconds)

I tried this code to make my listview start showing the last message `

if (MessagesListView.ItemsSource != null) { lastItem =MessagesListView.ItemsSource.Cast

When I open the page the listview scrolls but it doesn't reach the last item.
Although after the refresh, the listview scrolls to the last item successfully.


dotnet-xamarinforms
Comment
Comment · Show 2
Comment
5 |1600 characters needed characters left characters exceeded
  • Visible to all users
  • Visible to the original poster & Microsoft
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Visible to all users

Attachments: Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JessieZhang-2116 · May 12 at 02:48 AM

Hi @AnasGuibene ,I did a test, but I couldn't reproduce this problem. Could you please post a basic demo to github or onedriver so that we can test on our side?
Note: If you want to make the whole last item visible, you can try to change code to : MessagesListView.ScrollTo(lastItem, ScrollToPosition.MakeVisible, true);

0 Votes 0 ·
AnasGuibene · May 12 at 11:25 AM

This is a screenshot when I start the chat page :
the listview scrolls but it stop before the last item shows

oCrWlv3


0 Votes 0 ·
AnasGuibene answered May 21, '21

@JessieZhang-2116 i just found the solution
the problem was in the scrollview
I deleted the scroll view and all is good

Comment
Comment Show 0
Comment
5 |1600 characters needed characters left characters exceeded
  • Visible to all users
  • Visible to the original poster & Microsoft
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Visible to all users

Attachments: Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JessieZhang-2116 answered May 13, '21 | JessieZhang-2116 commented May 21, '21

Hello,


Welcome to our Microsoft Q&A platform!

According to your screenshot ,I found that the below bar should have overlayed the content of your listview below . So, that's the problem.

In fact, the listview has reached the last item when scrolling while using following code:

if (MessagesListView.ItemsSource != null) { lastItem =MessagesListView.ItemsSource.Cast

But the last sevaral items have been overlayed by the above float bar

Android listview not scrollable

As a test, I simulated such condition, and set the color of the bottom part to transparent color, the result is:

Android listview not scrollable

From above image, we can find that some part of the listview has been overlayed by the bottom part.

So, if you want to the last item of your listview could be visible to users, you can put your listview on top of your the bottom part not overlayed by the bottom part.

Best Regards,


Jessie Zhang


If the response is helpful, please click "Accept Answer" and upvote it.



Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



image.png (27.4 KiB)
image.png (114.4 KiB)
Comment
Comment · Show 3
Comment
5 |1600 characters needed characters left characters exceeded
  • Visible to all users
  • Visible to the original poster & Microsoft
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Visible to all users

Attachments: Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JessieZhang-2116 · May 21 at 09:40 AM

Hi @AnasGuibene, I have not heard from you for a couple of days. Please let me know if there is anything that I can help here.

0 Votes 0 ·
AnasGuibene · May 21 at 09:59 AM

hi @JessieZhang-2116

How can i put my listview on the part ! i cannot understand what you mean

0 Votes 0 ·
JessieZhang-2116 AnasGuibene · May 21 at 10:53 AM

I mean that the bottom part of the list has been overlayed by the bottom part(the input box). You can put the listView and the bottom part(the input box) into a `StackLayout instead of having the input box overlay the ListView..

0 Votes 0 ·