【问题标题】:Xamarin forms Scrolling not working with PullToRefreshLayout in table viewXamarin 表单滚动不适用于表视图中的 PullToRefreshLayout
【发布时间】:2019-05-09 09:53:42
【问题描述】:

我正在使用https://github.com/jamesmontemagno/Xamarin.Forms-PullToRefreshLayout 在 XAML 中实现表视图。这是结构

 <views:BaseContentPage.Content>
        <controls:PullToRefreshLayout x:Name="PullToRefreshLayout" IsPullToRefreshEnabled="True" RefreshCommand="RefreshPatientDetailsPage" RefreshColor="{StaticResource NavigationPrimary}">            
                <StackLayout>
                <ActivityIndicator Style="{StaticResource ActivityIndicator}" IsVisible="False"></ActivityIndicator>
                <TableView x:Name="ClinicleTableView" HasUnevenRows="True">                    
                 ----------------------------------------
                 ----------------------------------------
                </TableView>
            </StackLayout>            
        </controls:PullToRefreshLayout>
    </views:BaseContentPage.Content>

当我向下滚动页面时,拉动刷新正在工作。但页面没有滚动。我想让页面向下滚动并在滚动完成后触发拉动刷新。该怎么做?

【问题讨论】:

  • 在滚动视图和堆栈布局中设置HorizontalOptions="FillAndExpand" 和VerticalOptions="FillAndExpand" 是否有帮助?
  • 当我在这里使用滚动视图时,底部的项目不会显示在视图中。我会用stacklayout试试。 @JulioE.RodriguezCabañas
  • 我以为您已经在滚动视图中使用了堆栈布局?我肯定会这样做,因为样本就是这样做的。
  • 其实他们不支持stacklayouts,只支持listviews和scrollviews。
  • 当我在滚动视图中使用 stacklayout 时,底部项目不显示。当我删除滚动视图时,页面滚动正常,因为它包含一个表格视图。那么问题是滚动时触发刷新。我无法滚动。

标签: xamarin xamarin.forms pull-to-refresh


【解决方案1】:

我重新安排了我的 XAML 代码,它按预期工作

<views:BaseContentPage.Content>               
   <StackLayout>
      <ActivityIndicator Style="{StaticResource ActivityIndicator}" IsVisible="False"></ActivityIndicator>
         <controls:PullToRefreshLayout x:Name="PullToRefreshLayout" IsPullToRefreshEnabled="True" RefreshCommand="RefreshPatientDetailsPage" RefreshColor="{StaticResource NavigationPrimary}">    
              <TableView x:Name="ClinicleTableView" HasUnevenRows="True">                    
                 ----------------------------------------
                 ----------------------------------------
              </TableView>
         </controls:PullToRefreshLayout>
    </StackLayout>                    
 </views:BaseContentPage.Content>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-29
    • 2020-11-18
    • 1970-01-01
    • 1970-01-01
    • 2020-03-14
    • 1970-01-01
    相关资源
    最近更新 更多