How change color of specific item of listview?

user3266062

I have a customlistadapter as follow:

public class CustomListViewAdapter2 extends ArrayAdapter<RowItem> {
    List<Integer> baseOnThis;
    public CustomListViewAdapter2(Context context, int resourceId,
        List<RowItem> items, ArrayList<Integer> ids) {
    super(context, resourceId, items);
    this.context = context;
    baseOnThis= ids;
}

/* private view holder class */
private class ViewHolder {
    TextView firstHemistich;
    TextView SecondHemistich;
}

public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    RowItem rowItem = getItem(position);


    LayoutInflater mInflater = (LayoutInflater) context
            .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    if (convertView == null) {

        convertView = mInflater.inflate(R.layout.hemistich_rows, null);
        holder = new ViewHolder();
                    holder.firstHemistich = (TextView) convertView
                .findViewById(R.id.title);
        holder.SecondHemistich = (TextView) convertView
                .findViewById(R.id.desc);

        convertView.setTag(holder);
    } else
        holder = (ViewHolder) convertView.getTag();

    holder.firstHemistich.setText(rowItem.getTitle());
    holder.SecondHemistich.setText(rowItem.getDesc());

    return convertView;
}

now I need base on the database value that saved on Arraylist of "baseOnThis" change the color of item of listview but I can't. Is there any idea how should I do this? Please let me know if my question is wrong and don't minus me

Shini

Try this

if(position == 3){
        holder.SecondHemistich.setTextColor(this.context.getResources().getColor(R.color.color1));
}   

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Android - Change background color of specific item of ListView

From Dev

How to change the Foreground Color of ListView Selected Item

From Dev

How to change the text color of a ListView item?

From Dev

How to change the Foreground Color of ListView Selected Item

From Dev

How to change selected listview item color

From Dev

How to change listview item text color and image color from handler

From Dev

How specific a unique color to each row item of listview on android?

From Dev

How do I change the color of a selected item on a ListView?

From Dev

Android ListView. How to change background color of manually selected item

From Dev

How to change color of the selected ListView item [WP8.1]

From Dev

How to change Highlight color of the selected ListView item in UWP (Windows 10)

From Dev

uwp: how to change background color of listview item based on its value?

From Dev

How to change the listview's item color and keep it longer in android?

From Dev

how to change color of list item when it is selected in listview?

From Dev

How to change the background color of a non-visible item in ListView in Android

From Dev

How to change background color in multiple item delete in ListView

From Dev

C# Listview - How to change the color of each new item?

From Dev

How to change the color of a cell(back or fore color) of listview item according to item value

From Dev

Qt how to change the highlight color of a specific QComboBox item

From Dev

Android change listview item text color

From Dev

Unable to change the text color of ListView item

From Dev

Change the color of a specified item in a listview for android

From Dev

Android How to add icon on each listvIew list item and change the text color,Background color

From Dev

change color of one specific row in listview

From Dev

change color of one specific row in listview

From Dev

How to sort listview according to a specific listview item

From Dev

How to change the icon of a listview item

From Dev

How to change the icon of a listview item

From Dev

Change background color and font color of selected item in listview

Related Related

  1. 1

    Android - Change background color of specific item of ListView

  2. 2

    How to change the Foreground Color of ListView Selected Item

  3. 3

    How to change the text color of a ListView item?

  4. 4

    How to change the Foreground Color of ListView Selected Item

  5. 5

    How to change selected listview item color

  6. 6

    How to change listview item text color and image color from handler

  7. 7

    How specific a unique color to each row item of listview on android?

  8. 8

    How do I change the color of a selected item on a ListView?

  9. 9

    Android ListView. How to change background color of manually selected item

  10. 10

    How to change color of the selected ListView item [WP8.1]

  11. 11

    How to change Highlight color of the selected ListView item in UWP (Windows 10)

  12. 12

    uwp: how to change background color of listview item based on its value?

  13. 13

    How to change the listview's item color and keep it longer in android?

  14. 14

    how to change color of list item when it is selected in listview?

  15. 15

    How to change the background color of a non-visible item in ListView in Android

  16. 16

    How to change background color in multiple item delete in ListView

  17. 17

    C# Listview - How to change the color of each new item?

  18. 18

    How to change the color of a cell(back or fore color) of listview item according to item value

  19. 19

    Qt how to change the highlight color of a specific QComboBox item

  20. 20

    Android change listview item text color

  21. 21

    Unable to change the text color of ListView item

  22. 22

    Change the color of a specified item in a listview for android

  23. 23

    Android How to add icon on each listvIew list item and change the text color,Background color

  24. 24

    change color of one specific row in listview

  25. 25

    change color of one specific row in listview

  26. 26

    How to sort listview according to a specific listview item

  27. 27

    How to change the icon of a listview item

  28. 28

    How to change the icon of a listview item

  29. 29

    Change background color and font color of selected item in listview

HotTag

Archive