I have a problem with the footer for a list (I cannot focus the footer).
I am using a footer for an infinite list.
The problem I am facing is that the footer does not stretch to fit the width of the list (the wrap_content method is used instead).
This is the layout of the footer:
<?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>
And this is how I add the footer to the list:
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);
And here is the final result: (I can not send images to stackoverflow, but here is an external link to the image) http://s21.postimg.org/3zkd7pic7/listview_footer_problem.png
I tried everything to focus on the footer, but nothing worked. I hope someone can help me because it causes me some time.
Thanks.
source share