Johann
Johann

Reputation: 29867

ListView footer not expanding to parent width

In my ListView I have a footerview but its TextView is not expanding to the width of the parent. Here is my footer xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="5dp" >

    <TextView
        android:id="@+id/tvShowMore"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center"
        android:text="Show more"
        android:textSize="18sp" />

</LinearLayout>

And here is my code:

          LayoutParams llParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
          viewFooterShowMore.setLayoutParams(llParams);
          lvEvents.addFooterView(viewFooterShowMore);

Upvotes: 0

Views: 489

Answers (1)

BenjaminFranklin
BenjaminFranklin

Reputation: 808

You could try using

 android:layout_width="match_parent"

Upvotes: 2

Related Questions