Note that there are some explanatory texts on larger screens.

plurals
  1. POCan i put text in the left and in the right side of the elements of a listview?
    text
    copied!<p>i have to make a listview that haves a list of names, and also, aligned to the left, but in the same field, the sex of the person, male or female</p> <p>is possible to do it? how?</p> <p>code examples welcome</p> <p>EDIT</p> <p>I try with the first user answer, and i got this exception: <code>12-14 22:39:56.191: ERROR/AndroidRuntime(917): java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView</code></p> <p>this is the code of the XML item i make:</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" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Left side" android:layout_alignParentLeft="true"/&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Right side" android:layout_alignParentRight="true"/&gt; &lt;/RelativeLayout&gt; </code></pre> <p>and this is the code where i have my list:</p> <pre><code>public class PendingInvitations extends ListActivity { ...... ..... .... @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); private List&lt;String&gt; usernames=new ArrayList&lt;String&gt;(); for (int i=0;i&lt;friends.size();i++) { usernames.add(i,friends.get(i).getFullName()); } setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list_item2, usernames)); </code></pre>
 

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