I'm creating an app with listview and I added few values like 101,102 to 110 to the listview. Now I have to change the listview item background colour using edittext. For example if I type 101 and click submit button, background colour of 101 should change. Please help. Please......
First Declare the layout of adapter
linearlayout = itemView.findViewById(R.id.linearLayout);
then set color if match the number in onBindViewHolder()
if((position.Value())==typedValue){
holder.linearlayout.setBackgroundColor(Color.parseColor("#FF003B"));
}
You can try
listView.setSelectorColor(getResources().getColor(R.color.colorPrimaryDark))
You can see this [ Change background color of selected item on a ListView
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.