listview item background color change

后端 未结 5 700
甜味超标
甜味超标 2020-12-16 08:43

I am working on an android application. I have created a listview by using

setListAdapter(new ArrayAdapter(this,android.R.layout.simple_list_i         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-16 09:19

    What you can do is instead of using .setBackgroundColor() with a Color value, create a Color State List and assign it with .setBackgroundResource(). That way, you can define the various states that your list item can become, depending on the item's current state.

提交回复
热议问题