Note that there are some explanatory texts on larger screens.

plurals
  1. POlist with text on both left and right side of each item? (Android)
    primarykey
    data
    text
    <p>i'd like to start by saying that im quite new to android developing.</p> <p>my question is how can i change my below examples to allow text on both the left and right side of each list item.</p> <p>my aim is to have each list item have an item description on the left, and a numeric value for that description on the right.</p> <p>all i have up to now is a list that shows the values which i want showing on the left of each item.</p> <p>main java activity (NewtestActivity.java):</p> <pre><code>public class NewtestActivity extends Activity { String[] exampleList = { "Item 1", "Item 2", "Item 3", "Test 4", "Item 5", "Test 6", "Item 7", "Test 8" //etc etc }; @Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.main); // Get an instance of your listview in code ListView listview = (ListView) findViewById(R.id.list); // Set the listview's adapter listview.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, exampleList)); } } </code></pre> <p>main.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:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;LinearLayout android:orientation="horizontal" android:layout_width="280dp" android:layout_height="fill_parent" &gt; &lt;ImageView android:src="@drawable/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" android:layout_marginLeft="5dp" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="14dp" android:layout_marginLeft="5dp" android:text="@string/app_name" /&gt; &lt;/LinearLayout&gt; &lt;ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="200dp" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>thanks for any help (:</p>
    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.
 

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