First of, I’m using The Android Compatibility Library V4 rev.3 for my 1.6(Donut)
When you first create a ListFragment it displays an indeterminant progress indicator untill you use setListAdabpter(). According to the documentation of ListFragment.onCreateView, if I want to use a custom lay out:
If you are overriding this method with your own custom content,
consider including the standard layout {@link
android.R.layout#list_content} in your layout file, so that you
continue to retain all of the standard behavior of ListFragment. In
particular, this is currently the only way to have the built-in
indeterminant progress state be shown.
The problem is that when I go into my layout file and try:
<include layout="@android:layout/list_content" ...> it (eclipse) tells me that
Resource is not public. (at ‘layout’ with value ‘@android:layout/list_content’).
I take that to mean list_content.xml doesn’t exist in my V4 source code. which is correct because according to the docs it appeared in API v11.
I just assumed it would exist in the compatibility library source, don’t know if it does…
The only other solution I can see would be to dig android’s API V11 source code and copy and paste list_content.xml. For now however I would like to avoid this hackery. is this the only solution?
The
ListFragmentincluded in the compatibility library doesn’t appear to use that layout (list_content) as the real one does. This might be because it is offered as a jar and it is not possible to package resources. Here are the contents of itsonCreateView:ListFragment from compatibility library:
ListFragment from Android 4.0:
Given the choice between copying the layout file from APIv11 source and including this view initialisation code, I think it is clear which one would be considered ‘hackery’ 😉