Android:将listfragment放入xml布局中
默认情况下,ListFragment在加载数据时显示进度条。我计划将listfragment放在xml文件中,并让它显示progressbar,直到我从服务器获取数据 我之所以尝试将listfragment放在xml中,是因为在我的布局中,在我计划放置listfragment的位置上方有一个线性布局 这是我的xml文件Android:将listfragment放入xml布局中,android,android-fragments,android-listfragment,Android,Android Fragments,Android Listfragment,默认情况下,ListFragment在加载数据时显示进度条。我计划将listfragment放在xml文件中,并让它显示progressbar,直到我从服务器获取数据 我之所以尝试将listfragment放在xml中,是因为在我的布局中,在我计划放置listfragment的位置上方有一个线性布局 这是我的xml文件 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http:/
<?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>
您是否尝试使用参数true?从文档中可以看出,它可能会起作用。为什么您不能在适配器内处理此问题?