Note that there are some explanatory texts on larger screens.

plurals
  1. POSet default ListView
    primarykey
    data
    text
    <p>Is there any way to change the <code>ListView</code> in a <code>SherlockListFragment</code> from defaulting to <code>R.id.list</code>? e.g. I have a custom list that overrides the default <code>ListView</code> in xml (list) that is defined as being below a linear layout. How do I make it so that <code>setListAdapter</code> will use this <code>ListView</code> instead of the default android <code>ListView</code>?</p> <p>XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_view_panel" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;LinearLayout android:id="@+id/toggleLL" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" &gt; &lt;ToggleButton android:id="@+id/toggle_button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /&gt; &lt;ToggleButton android:id="@+id/toggle_button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /&gt; &lt;ToggleButton android:id="@+id/toggle_button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /&gt; &lt;/LinearLayout&gt; &lt;ListView android:id="@id/android:list" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/toggleLL" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Fragment:</p> <pre><code>public class ProblemFragment extends SherlockListFragment { private SeparatedListAdapter list; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.getSherlockActivity().setContentView(R.layout.apps_layout); list = new SeparatedListAdapter(this.getSherlockActivity(), new Layout(R.layout.separated_list_adapter_two_text, R.id.two_text_title, R.id.two_text_desc)); setListAdapter(list); //Sets the list to the default list, not the overwritten list specified in the xml } } </code></pre>
    singulars
    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.
 

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