Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change ListView Selected items color from default to red without using selector
    primarykey
    data
    text
    <p>I am developing an App for cricket. In that my aim is to select players for the particular team in ListView. Here I can able to select multiple players from the list. I am using simple Adapter with multiple choice Listview.</p> <pre><code> adapter=new ArrayAdapter&lt;String&gt;(this,R.layout.custom_list_view,R.id.textView_color,playersName); lvview.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); </code></pre> <p>And I am using checkedTextView for multiple selection. Below is my custom_list_view with CheckedTextView</p> <pre><code> &lt;CheckedTextView android:id="@+id/textView_color" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:textAppearance="?android:attr/textAppearanceLarge" android:gravity="center_vertical" android:checkMark="?android:attr/listChoiceIndicatorMultiple" android:paddingLeft="6dip" android:paddingRight="6dip" android:textColor="#FFffFF" /&gt; </code></pre> <p>And now my problem is I want to change the color of listview when user select the particular player from the list. Its like to show the user which players are selected. To Differentiate from the unselected player I am changing the color of selected player to red. </p> <pre><code> lvview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int position,long id) { // TODO Auto-generated method stub SparseBooleanArray checked = lvview.getCheckedItemPositions(); if(checked.get(position)) { //chkTextView.setTextColor(Color.GREEN); counter_selected++; selectedCounterText.setText("" + counter_selected); } else { counter_selected--; selectedCounterText.setText("" + counter_selected); } } }); </code></pre> <p>How to change the color of selected player from default color to Red. I am struggling to do that.. Please help me to find it out.. </p>
    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.
 

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