リストビューのフッターに問題があります (フッターを中央に配置できません)。
無限のリストにフッターを使用しています。
私が抱えている問題は、リストの幅に合わせてフッターが引き伸ばされていないことです(代わりに、何らかの方法でwrap_contentを使用しています)。
フッターのレイアウトは次のとおりです。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/footer_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:padding="10dp" >
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Loading more..." />
</LinearLayout>
そして、これはリストビューにフッターを追加する方法です:
View footerView;
...
// Get the custom layout for footer
footerView = getActivity().getLayoutInflater().
inflate(R.layout.list_footer_load_more, getListView(), false);
LinearLayout footerViewLayout = (LinearLayout) footerView.findViewById(R.id.footer_layout);
// Adding custom view to ListView at footer
getListView().addFooterView(footerViewLayout, null, false);
最終結果は次のようになります: (stackoverflow に画像を投稿することはできませんが、画像への外部リンクを次に示します) http://s21.postimg.org/3zkd7pic7/listview_footer_problem.png
フッターを中央に配置するためにあらゆることを試みましたが、何も機能しませんでした。これはしばらくの間私にストレスを与えているので、誰かが私を助けてくれることを願っています.
ありがとうございました。