亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

有沒有辦法檢測 Xamarin 中滾動視圖何時到達底部?

有沒有辦法檢測 Xamarin 中滾動視圖何時到達底部?

C#
阿波羅的戰車 2023-09-09 16:09:53
我正在制作一個將一些圖像加載到滾動視圖的應用程序,我需要檢測用戶何時到達滾動視圖的底部以加載更多圖像。我已經嘗試過“scrollView.ContentSize.Height”,但 ContentSize 不存在。我能做些什么?我沒有使用 Xamarin.Forms,但我可以將其與 Xamarin.Android 一起使用嗎?
查看完整描述

2 回答

?
守著一只汪

TA貢獻1872條經驗 獲得超4個贊

你可以嘗試這樣的事情:


private void ScrollView_OnScrolled(object sender, ScrolledEventArgs e)

 {

            if (!(sender is ScrollView scrollView))

                return;


            var scrollingSpace = scrollView.ContentSize.Height - scrollView.Height;


            if (scrollingSpace > e.ScrollY)

                return;


            // load more content.

            DisplayAlert("Alert", "End of scroll view detected", "OK");

        }


查看完整回答
反對 回復 2023-09-09
?
交互式愛情

TA貢獻1712條經驗 獲得超3個贊

private void OnScrolled(object sender, ScrolledEventArgs e)

? ? {

? ? ? ? MyScrollView scrollView = sender as MyScrollView;

? ? ? ? double scrollingSpace = scrollView.ContentSize.Height - scrollView.Height;


? ? ? ? if (scrollingSpace <= e.ScrollY) // Touched bottom

? ? ? ? ? ? // Do the things you want to do

? ? }


查看完整回答
反對 回復 2023-09-09
  • 2 回答
  • 0 關注
  • 129 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號