swiperefreshlayout

How do I properly set SwipeRefreshLayout on Android Studio with kotlin?

柔情痞子 提交于 2020-04-18 06:25:59
问题 I'm trying to use a SwipeRefreshLayout on my project, but there's something wrong... and I don't know what! Below I show the kotlin code, XML and the error I'm getting. NOTE, it's a FRAGMENT KOTLIN CODE: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) swipeRefresh.setOnRefreshListener { refreshAction() // refresh your list contents somehow swiperefresh_saloes.isRefreshing = false } } XML CODE <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns

How do I properly set SwipeRefreshLayout on Android Studio with kotlin?

百般思念 提交于 2020-04-18 06:24:00
问题 I'm trying to use a SwipeRefreshLayout on my project, but there's something wrong... and I don't know what! Below I show the kotlin code, XML and the error I'm getting. NOTE, it's a FRAGMENT KOTLIN CODE: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) swipeRefresh.setOnRefreshListener { refreshAction() // refresh your list contents somehow swiperefresh_saloes.isRefreshing = false } } XML CODE <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns

RecycleView 上拉刷新,到底部自动加载

筅森魡賤 提交于 2020-03-13 09:07:28
Recycle请求到数据后(还没有请求数据的话看上一篇); 首先是下拉: <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swiperefreshlayout" android:layout_width="match_parent" android:layout_below="@id/title2" android:layout_height="wrap_content"> <android.support.v7.widget.RecyclerView android:id="@+id/id_recyclerview" android:divider="#ffff0000" android:dividerHeight="10dp" android:layout_width="match_parent" android:layout_height="match_parent" /> </android.support.v4.widget.SwipeRefreshLayout> 这是下拉的样式 然后是下拉的方法 mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override

尝试用kotlin做一个app(十二)

匆匆过客 提交于 2020-03-09 08:57:00
新闻列表页下拉刷新 1.使用谷歌官方的SwipeFreshLayout控件 简单使用 用<androidx.swiperefreshlayout.widget.SwipeRefreshLayout></androidx.swiperefreshlayout.widget.SwipeRefreshLayout>包裹RecyvlerView 设置颜色 swipeRefreshLayout.setColorSchemeColors(Color.GRAY)可以添加多种颜色 设置监听 swipeRefreshLayout.setOnRefreshListener { var pos:Int=this.intent.getStringExtra("posi").toInt() swipeRefreshLayout.isRefreshing=false } 新闻列表页上拉加载更多 思路是,在RecyclerView中新增一个item,判断如果Recycler滚动到最后一个item。从数据库读取更多数据,添加到原来的新闻列表的末尾。 创建一个布局的类LoadMoreView class LoadMoreView:RelativeLayout{ constructor(context: Context):super(context) constructor(context: Context

Android:ScrollView和SwipeRefreshLayout高度测量

偶尔善良 提交于 2020-02-24 12:00:14
今天组里的同事要做一个奇葩的效果,要求在ScrollView里嵌套一个RefreshLayout。类似代码如下: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> //红色背景 <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ff00ff"> //黄色背景 <android.support.v4.widget.SwipeRefreshLayout android:layout_width="match_parent" android:layout_height="fill_parent" android:background="#ffff00"> //黑色背景 <LinearLayout android:layout_width="match

Recycler view not scrolling properly after implementing swipe to refresh layout

人盡茶涼 提交于 2020-02-01 16:44:35
问题 Prior to the implementation of the Swipe to refresh view, the recycler view was working smoothly but not whenever I try to scroll the recycler view downwards the swipe to refresh interferes and hinders the scroll movement. Here is the screenshot of the issue : (Notice the swipe to refresh layout comes while the recycler view is scrolled downwards) Here is my layout fragment: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/activity_main

Recycler view not scrolling properly after implementing swipe to refresh layout

邮差的信 提交于 2020-02-01 16:41:22
问题 Prior to the implementation of the Swipe to refresh view, the recycler view was working smoothly but not whenever I try to scroll the recycler view downwards the swipe to refresh interferes and hinders the scroll movement. Here is the screenshot of the issue : (Notice the swipe to refresh layout comes while the recycler view is scrolled downwards) Here is my layout fragment: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/activity_main

When I am scrolling up SwipeRefreshLayout refreshing my app

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-21 07:00:09
问题 I am created an app that downloaded some data from internet and show them in a list using recyclerView.So I added SwipeRefreshLayout so that when user is at the beginning of the page he can pull from top to refresh (like facebook app).But In my app when I scroll down and again trying to scrolling up the SwipeRefreshLayout shows up and refreshing my page. I also search the internet but can't get the right answer. I try this solution but it doesn't work anymore(Because I am using recyclerView).

SwipeRefreshLayout - swipe down to refresh but not move the view pull down

喜你入骨 提交于 2020-01-09 09:07:23
问题 Is it possible ?? as a Title said swipe down to refresh Layout but stick the Layout not move it down along swipe gusture Thank you - I'm using SwipeRefreshLayout 回答1: You try this way listView.setOnScrollListener(new OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { boolean enable = false; if(listView != null && listView

Android短视频滑动播放(二)

主宰稳场 提交于 2020-01-07 10:21:21
Android短视频滑动播放(一) 上一篇文章中讲到了短视频滑动的基本实现,文末也给出了相应的例子,可以运行查看,本节进一步完善滑动处理内容,主要给出了数据更新内容,下拉刷新最新内容,上拉预加载,可不断向下滑动;同时,介绍了视频的暂停、继续处理,循环播放或自动滑动到下一条以及多布局的处理。 1. 数据刷新 内容刷新布局采用了SwipeRefreshLayout,实现经典式的下拉刷新控制。 <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/srf_video_list" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/rv_little_video" android:layout_width="match_parent" android:layout_height="match_parent" /> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> 模拟数据请求