Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Create the layout file <strong>list_content.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;LinearLayout android:id="@+id/progressContainer" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" android:gravity="center"&gt; &lt;ProgressBar style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:text="" android:paddingTop="4dip" android:singleLine="true" /&gt; &lt;/LinearLayout&gt; &lt;FrameLayout android:id="@+id/listContainer" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:drawSelectorOnTop="false" /&gt; &lt;TextView android:id="@+id/internalEmpty" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;/FrameLayout&gt; &lt;/FrameLayout&gt; </code></pre> <p>Put this inside your <strong>ListFragment</strong> class:</p> <pre><code>public ListView mList; boolean mListShown; View mProgressContainer; View mListContainer; public void setListShown(boolean shown, boolean animate){ if (mListShown == shown) { return; } mListShown = shown; if (shown) { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_out)); mListContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_in)); } mProgressContainer.setVisibility(View.GONE); mListContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_in)); mListContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_out)); } mProgressContainer.setVisibility(View.VISIBLE); mListContainer.setVisibility(View.INVISIBLE); } } public void setListShown(boolean shown){ setListShown(shown, true); } public void setListShownNoAnimation(boolean shown) { setListShown(shown, false); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { int INTERNAL_EMPTY_ID = 0x00ff0001; View root = inflater.inflate(R.layout.list_content, container, false); (root.findViewById(R.id.internalEmpty)).setId(INTERNAL_EMPTY_ID); mList = (ListView) root.findViewById(android.R.id.list); mListContainer = root.findViewById(R.id.listContainer); mProgressContainer = root.findViewById(R.id.progressContainer); mListShown = true; return root; } </code></pre> <p>Now you can use normally:</p> <pre><code>setListShown(boolean shown); setListShown(boolean shown, boolean animate); setListShownNoAnimation(boolean shown); </code></pre> <p>Source:</p> <blockquote> <p><a href="http://source-android.frandroid.com/frameworks/base/core/java/android/app/ListFragment.java">http://source-android.frandroid.com/frameworks/base/core/java/android/app/ListFragment.java</a></p> <p><a href="http://source-android.frandroid.com/frameworks/base/core/res/res/layout/list_content.xml">http://source-android.frandroid.com/frameworks/base/core/res/res/layout/list_content.xml</a></p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload