Как решить проблему с просмотром списка: не весь код выполняется ⇐ Android
-
Anonymous
Как решить проблему с просмотром списка: не весь код выполняется
I have this 3 lines of code which I use to hold the state of items in my listview when scrolling, but my problem is, the last line of code only gets executed. This is the code block:
holder.viewName.setTextColor((priority.equals("Low")? Color.BLUE: Color.GRAY ) ); holder.viewName.setTextColor((priority.equals("Medium")? Color.GREEN: Color.GRAY ) ); holder.viewName.setTextColor((priority.equals("High")? Color.RED: Color.GRAY ) ); // items in this state condition only gets executed in the listview, the rest are ignored and set to gray. Is there a way I can join the code logic together, so that all 3 conditions can be called?
Источник: https://stackoverflow.com/questions/419 ... s-executed
I have this 3 lines of code which I use to hold the state of items in my listview when scrolling, but my problem is, the last line of code only gets executed. This is the code block:
holder.viewName.setTextColor((priority.equals("Low")? Color.BLUE: Color.GRAY ) ); holder.viewName.setTextColor((priority.equals("Medium")? Color.GREEN: Color.GRAY ) ); holder.viewName.setTextColor((priority.equals("High")? Color.RED: Color.GRAY ) ); // items in this state condition only gets executed in the listview, the rest are ignored and set to gray. Is there a way I can join the code logic together, so that all 3 conditions can be called?
Источник: https://stackoverflow.com/questions/419 ... s-executed
Мобильная версия