Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li>You create your main.xml</li> <li><p>Add to it a ListView</p> <pre><code>&lt;ListView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/myListView" android:divider="#ffa500" android:dividerHeight="1px" android:background="@drawable/somedrawable_xml" android:choiceMode="singleChoice"&gt;&lt;/ListView&gt; </code></pre></li> </ol> <p><code>somedrawable_xml.xml</code> could be any drawable example:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;solid android:color="#00ffa500" /&gt; &lt;stroke android:width="2dp" android:color="#ffffa500" /&gt; &lt;padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /&gt; </code></pre> <p></p> <p>Add a layout xmlFile <code>myLayout.xml</code> example: (I added imageView for demonstration) anyway what is important is the id of the textview</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/dasdasd"&gt; &lt;TextView android:text="TextView" android:layout_height="wrap_content" android:id="@+id/thisIsTheTextView" android:layout_width="wrap_content" android:textAppearance="? android:attr/textAppearanceLarge"&gt;&lt;/TextView&gt; &lt;ImageView android:src="@drawable/icon" android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true"&gt;&lt;/ImageView&gt; </code></pre> <p></p> <p>finally in your <code>Activity</code></p> <pre><code>ArrayAdapter myAD=new ArrayAdapter(mContext,R.layout.myLayout,R.id.thisIsTheTextView,new String[] {"item1", "item2", "item3", "item4", "item5"}); myListView.setAdapter(myAD); </code></pre>
    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.
    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