Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to create a CustomListAdapter. </p> <pre><code>public class CustomListAdapter extends ArrayAdapter &lt;String&gt; { private Context mContext; private int id; private List &lt;String&gt;items ; public CustomListAdapter(Context context, int textViewResourceId , List&lt;String&gt; list ) { super(context, textViewResourceId, list); mContext = context; id = textViewResourceId; items = list ; } @Override public View getView(int position, View v, ViewGroup parent) { View mView = v ; if(mView == null){ LayoutInflater vi = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mView = vi.inflate(id, null); } TextView text = (TextView) mView.findViewById(R.id.textView); if(items.get(position) != null ) { text.setTextColor(Color.WHITE); text.setText(items.get(position)); text.setBackgroundColor(Color.RED); int color = Color.argb( 200, 255, 64, 64 ); text.setBackgroundColor( color ); } return mView; } } </code></pre> <p>The list item looks like this (custom_list.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:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textView" android:textSize="20px" android:paddingTop="10dip" android:paddingBottom="10dip"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>Use the TextView api's to decorate your text to your liking</p> <p>and you will be using it like this </p> <pre><code>listAdapter = new CustomListAdapter(YourActivity.this , R.layout.custom_list , mList); mListView.setAdapter(listAdapter); </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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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