Xamarin - WebView Pull To Refresh

时间:2018-06-15 07:39:37

标签: c# xamarin webview pull-to-refresh

我在谷歌的各个地方都进行了搜索,似乎这种“拉动刷新”功能仅适用于ListViews。有一些关于WebView的“Pull To Refresh”的帖子,但它们是用Java和Android Studio编写的。有没有简单的方法来实现这个?

1 个答案:

答案 0 :(得分:2)

您可以使用@jamesmontemagno's PullToRefreshLayout并在PullToRefreshLayout元素中包含您的WebView:

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage 
    xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    x:Class="RefreshSample.Views.ScrollViewXamlPage"
    xmlns:controls="clr-namespace:Refractored.XamForms.PullToRefresh;assembly=Refractored.XamForms.PullToRefresh"
    Title="Xaml Scroll">
   <controls:PullToRefreshLayout
          IsPullToRefreshEnabled="True"
          RefreshCommand="{Binding RefreshCommand}"
          IsRefreshing="{Binding IsBusy}"
          RefreshColor="Blue">

        <WebView>
        </WebView>

   </controls:PullToRefreshLayout>
</ContentPage>