Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make a splitscreen with a listview on one side
    primarykey
    data
    text
    <p>I want the right side of the activity to show different items depending which item of the listview on the left is selected. I was able to follow the Android ListView example where the listview takes up the whole activity screen, but was unable to expand that to split screen. Here is my xml with the list view on the left and a simple button on the right for now. I'm having trouble figuring out the code that will populate my listview.</p> <p>system_status.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/activity_system_status" android:title="@string/system_status" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:layout_weight="1"&gt; &lt;ListView android:id="@+id/my_list" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:layout_weight="1"&gt; &lt;ToggleButton android:text="ToggleButton" android:id="@+id/toggleButton1" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt;&lt;/ToggleButton&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>UPDATE:</strong> I figured it out with the help of Scythe's post. Here is the code that got it working. The xml above works as is.</p> <pre><code>public class SystemStatusActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ListView lv = (ListView) findViewById(R.id.my_list); String[] stats = getResources().getStringArray(R.array.array_system_status); lv.setAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, stats)); } } </code></pre> <p>list_item.xml:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:textSize="16sp" &gt; &lt;/TextView&gt; </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.
    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