J'ai un problème avec un pied de page pour la liste (je ne peux pas centrer le pied de page). J'utilise un pied de page pour une liste sans fin. Le problème que j'ai est que le pied de page n'est pas étiré pour correspondre à la largeur de la liste (à la place est en quelque sorte en utilisant wrap_content).Largeur du pied ListView
C'est la mise en page de bas de page:
<?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>
Et voici comment ajouter le pied de page à la listview:
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);
Et voilà comment le résultat final ressemble à: (je peux 't publie des images sur stackoverflow, mais voici un lien externe vers l'image) http://s21.postimg.org/3zkd7pic7/listview_footer_problem.png
J'ai tout essayé pour cente r le pied de page mais rien n'a fonctionné. J'espère que quelqu'un pourra m'aider, parce que cela me stressera pendant un certain temps.
Merci.
Malheureusement, il est toujours le même –
@IonutNegru j'ai changé un peu le code . Voyez si cela fonctionne maintenant. – Vikram
@IonutNegru Et, en gonflant 'R.id.footer_layout', utilisez' gonfler (R.layout.list_footer_load_more, null); ' – Vikram