最近碰到一个这样的需求,客户想要加一个下拉刷新的功能。我一看,这不是很简单。引入SmartRefreshLayout控件,唰唰刷几下布局就写好了。
这是主布局:
<?xml version="1.0" encoding="utf-8"?>
<com.ggh.michat.widget.PagingRecyclerViewContainer xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<androidx.core.widget.NestedScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.tabs.TabLayout
android:id="@+id/chat_square_tab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
app:tabGravity="center"
app:tabIndicatorFullWidth="false"
app:tabIndicatorHeight="0dp"
app:tabMode="scrollable"
app:tabRippleColor="@android:color/transparent" />
<ImageView