Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid List Below Toggle Buttons
    primarykey
    data
    text
    <p>I have a list that is intended to be below toggle buttons. The list grabs data from a server and then parses them. My XML is as follows:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" &gt; &lt;ToggleButton android:id="@+id/toggle_button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:textOff="Apps" android:textOn="Apps" /&gt; &lt;ToggleButton android:id="@+id/toggle_button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/toggle_button1" android:layout_weight="1" android:textOff="VMs" android:textOn="VMs" /&gt; &lt;ToggleButton android:id="@+id/toggle_button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/toggle_button2" android:layout_weight="1" android:textOff="Groups" android:textOn="Groups" /&gt; &lt;ListView android:id="@+id/mylist" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/toggle_button1" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Code for the actual 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.problem_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)); ToggleButton b1 = (ToggleButton) this.getSherlockActivity().findViewById(R.id.toggle_button1); ToggleButton b2 = (ToggleButton) this.getSherlockActivity().findViewById(R.id.toggle_button2); ToggleButton b3 = (ToggleButton) this.getSherlockActivity().findViewById(R.id.toggle_button3); setListAdapter(list); refresh(); } public void refresh() { list = new SeparatedListAdapter(this.getSherlockActivity(), new Layout(R.layout.separated_list_adapter_two_text, R.id.two_text_title, R.id.two_text_desc)); refreshStats(); } public void refreshStats() { //Omitted parsing code list.addSection(new String("Hello world!!")); setListAdapter(list); } } </code></pre> <p>However, when I use setListAdapter(list), the buttons are overwritten. They are visible before the app retrieves the data and parses it, but they are overwritten after I call setListAdapter. How can i fix this?</p>
    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.
    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