这是我的RecyclerView的布局:
<com.xxx.mobile.ui.widget.list.PagingRecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:clipToPadding="false"
android:paddingTop="16dp" />
我使用此布局在我的RecyclerView中添加类似页脚:
loading_view.xml
<LinearLayout android:id="@+id/loading_view"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/loading_spinner"
style="?android:progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
它工作正常,但progressBar不是水平居中......
Ps:我的RecyclerView在初始化时使用LinearLayout:
myRecyclerView.setHasFixedSize(true);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(this.getActivity());
myRecyclerView.setLayoutManager(mLayoutManager);
感谢您的帮助!