Note that there are some explanatory texts on larger screens.

plurals
  1. PORight and left align in a single ListView
    primarykey
    data
    text
    <p>I am setting a <code>listView</code> dynamically. I will have two things shown on each line that I will be receiving from <code>parse.com</code>. I want the first thing to be left aligned and blue, with the second thing right aligned and red. I will have two arrays, <code>firstArray</code>, and <code>secondArray</code>. I found lots of ways to do this, but none dynamically. How should I go about doing this, or I can do it in <code>xml</code>?</p> <p><strong>Updated</strong> </p> <p>This is my <code>xml</code> after that tutorial posted by @t0s</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:padding="2dp" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" &gt; &lt;TextView android:id="@+id/column1" android:layout_width="50dip" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#0000FF" android:gravity="left" /&gt; &lt;TextView android:id="@+id/center" android:text="VS" android:textSize="15sp" android:layout_width="50dip" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#FFFFFF" android:gravity="center" /&gt; &lt;TextView android:id="@+id/column2" android:layout_width="50dip" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#FF0000" android:gravity="right" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>and my java</p> <pre><code> ListView list = (ListView) findViewById(R.id.mylist); ArrayAdapter&lt;String&gt; listAdapter = new ArrayAdapter&lt;String&gt;(MainActivity.this, R.layout.mylist, namesArray); list.setAdapter(listAdapter); //find my objects off parse, and call this method private String display(Object name, Object record, ArrayAdapter listAdapter) { String fightCard = (name).toString(); namesArray.add((name).toString() +" " + (record).toString()); return fightCard; } </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.
 

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