Vihaan Verma
Vihaan Verma

Reputation: 13143

Android : put listfragment inside xml layout

ListFragment by defaults shows a progressbar while the data get loaded. I plan on putting the listfragment in xml file and have it show progressbar till I get the data from the server.

The reason I m trying to put listfragment inside xml is because in my layout I have a linearlayout above the place where I plan to put listfragment.

Here is my xml file.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
     >

    <LinearLayout 
        android:id="@+id/filterHolder"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:background="@color/white"
        >
             <ToggleButton
                    android:id="@+id/filterToggleButton"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@color/white"
                    android:textColor="@color/black"
                    android:textOff="@string/filterToggleButtonText"
                    android:textOn="@string/filterToggleButtonText"
                    android:drawableLeft="@drawable/filter_small"
                    />
    </LinearLayout>

    <fragment 
          andorid:name="in.coupondunia.androidapp.testListFragment"

        android:id="@+id/couponsByCategoryFragment"
        android:layout_below="@id/filterHolder"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        />

</RelativeLayout>

Upvotes: 0

Views: 150

Answers (1)

azertiti
azertiti

Reputation: 3150

Have you tried using http://developer.android.com/reference/android/app/ListFragment.html#setListShown(boolean) with parameter true? From the docs it might work.

Upvotes: 1

Related Questions