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>
模拟数据请求,定义isLoadMoreData判断是刷新数