草庐IT

swiperefreshLayout

全部标签

android - SwipeRefreshLayout 隐藏在空的 RecyclerView 上

我有一个Fragment,其中有一个SwipeRefreshLayout,然后是RecyclerView作为child。提交Fragment后,它开始与服务器通信以检索一些数据并填充将为RecyclerView提供服务的CustomAdapter。用户可以通过向下滑动或按下ActionBar上的按钮来刷新内容。在后一种情况下,我手动调用swipeRefreshLayout.setRefreshing(true)。所以到现在为止没有麻烦。当我在RecyclerView的第一次加载期间手动调用刷新状态时出现问题(onStart())。进度指示器没有显示,我假设是因为RecyclerView

Android ProgressBar 的样式类似于 SwipeRefreshLayout 中的进度 View

我在我的Android应用程序中使用android.support.v4.widget.SwipeRefreshLayout。它包装了一个ListView。ListView的内容是从服务器下载的。当用户向下滑动以从服务器重新加载数据时,会显示一个进度View。进度View看起来像一block圆圈,在动画过程中会变大和变小。这个progressview的样式好像不能定制太多。不过,我很喜欢它的内置样式。我还在初始数据加载期间显示相同的进度动画。这可以通过调用mySwipeRefreshLayout.setRefreshing(true)来实现。这也完全没问题。但是,我想在整个应用程序中显

android - 如何将颜色资源 ID 的 int 数组从 array.xml 传递到 SwipeRefreshLayout.setColorSchemeResources

我已经让Android的SwipeRefreshLayout正常工作,我正在尝试自定义整个应用程序中所有拉动刷新的颜色。为了遵循DRY原则,我尝试将所需的颜色移动到array.xml,如下所示:@color/pink@color/green但是,当我尝试将它们导入滑动刷新时:swipeRefreshLayout.setColorSchemeResources(R.array.swipeRefreshColors);我得到一个Resources$NotFoundException:android.content.res.Resources$NotFoundException:Resour

android - SwipeRefreshLayout 拦截与 ViewPager

我有一个ViewPager包裹在SwipeRefreshLayout中。有时,当我向左/向右滑动时,SRL会被触发。这主要发生在我位于fragment顶部时。我该如何解决这个问题?我是否需要监听某种事件才能在特定时间内禁用SRL?我还没有真正找到任何相关信息,所以我怀疑这是谷歌的一个实际错误,而是我是否错误地实现了某些事情?对此有什么想法吗?这是我的布局:谢谢!如果我遗漏了任何信息,请告诉我。 最佳答案 我设法解决了它:mainViewPager.addOnPageChangeListener(newTabLayout.TabLay

android - 在 webview 中向上滚动会导致 SwipeRefreshLayout 刷新

我在FrameLayout中有一个WebView,用于添加选项卡,因为我正在创建浏览器。FrameLayout位于SwipeRefreshLayout内。问题:每当我在WebView中快速向上滚动内容时,刷新图标就会从工具栏后面出现。它应该只发生在WebView内容位于顶部时。它与FrameLayout有关,当我删除它时,问题就消失了。布局看起来像这样: 最佳答案 只需使用ViewTreeObserver.OnScrollChangedListener实现您的Fragment或Activity,然后将Listener设置为webvi

android - SwipeRefreshLayout 拉取多次行为(SDK 23)

我有这样的SwipeRefreshLayout:.xml:.java:privateSwipeRefreshLayoutswipeLayout;swipeLayout=(SwipeRefreshLayout)rootView.findViewById(R.id.swipe_refresh_layout);swipeLayout.setColorSchemeColors(getResources().getColor(R.color.primary_color));swipeLayout.setOnRefreshListener(newOnRefreshListener(){@Overr

android - 如何使用新的分页库实现 SwipeRefreshLayout

我有一个向用户显示项目列表的Activity,它使用了分页库。我的问题是当用户向下滑动屏幕时我无法重新加载列表,以便它再次从服务器获取数据。这是我的数据源工厂:publicclassCouponListDataSourceFactoryextendsDataSource.Factory{privateCouponListDataSourcedataSource;publicCouponListDataSourceFactory(CouponRepositoryrepository,Stringtoken,StringvendorId){dataSource=newCouponListD

android - 制作自定义 SwipeRefreshLayout Indicator?

我将如何制作一个自定义指示器,该指示器将使用可绘制对象和用于SwipeRefreshLayout的自定义动画?我查看了SwipeRefreshLayout的源代码,发现CircleImageView对象是私有(private)的。有没有办法修改ImageView? 最佳答案 你可以通过反射改变drawable,不知道这个想法有多好。像这样的东西:mSwipeRefreshLayout=(SwipeRefreshLayout)findViewById(R.id.your_swiperefresh_id);try{Fieldf=mSwi

android - 如何更改 SwipeRefreshLayout 中的样式 progerssbar?

我使用SwipeRefreshLayout来更新我的列表。一切正常。但我不喜欢进度条。它是圆的。并携箭旋转。我见过这样的例子,其中一strip从中心移动到边缘。如何设置进度条样式?privateSwipeRefreshLayoutswipeLayout;...swipeLayout=(SwipeRefreshLayout)v.findViewById(R.id.swipe_guest_list);swipeLayout.setColorSchemeColors(Color.RED,Color.GREEN,Color.BLUE,Color.CYAN);swipeLayout.setOnR

android - LinearLayout 上的 SwipeRefreshLayout?

在ListView上,SwipeRefreshLayout工作正常。但是,仅在LinearLayout上(没有ListView),行为很奇怪。SwiperefreshLayout的进度条没有完全显示,事实上,它只出现了几分之一秒。可能是什么问题? 最佳答案 在SwipeRefreshLayout内的LinearLayout中,设置android:clickable="true" 关于android-LinearLayout上的SwipeRefreshLayout?,我们在StackOve