Android disabling highlight on listView click
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
ListView shows a pressed or selected highlight because Android applies a selector drawable when the user touches a row. If you want the click to perform its action without changing the row background, you need to replace or neutralize that selector instead of fighting the behavior from inside the adapter.
Where the Highlight Comes From
The visual flash is usually controlled by the list selector, not by the onItemClick callback itself. ListView draws the selector over or behind the row to indicate pressed, focused, or selected state.
That is why clearing the background inside getView() usually does not solve the problem. The view may still be drawn with the selector when touched.
The quickest XML solution is to set a transparent selector on the ListView:
This tells the ListView to keep handling clicks normally while drawing no visible highlight.
Use a Custom Selector When You Need More Control
A fully transparent selector is fine if you want no pressed-state feedback at all. If you want finer control, define your own selector drawable and point android:listSelector at it.
Create res/drawable/list_selector.xml:
Then use it:
This is more explicit and easier to extend if you later decide to show a subtle pressed state instead of none at all.
Programmatic Alternative
If you need to control this in code, set the selector directly:
That is useful when the same screen can switch between selectable and non-selectable modes. The behavior is the same as the transparent XML selector, but the setting is applied at runtime.
Watch for Row Backgrounds and Clickable Children
If the highlight still appears after changing listSelector, the row layout itself may be drawing a stateful background. For example, a row root view with its own selector or ripple background can still show a pressed effect even when the ListView selector is transparent.
A minimal row layout that stays visually neutral looks like this:
Also check whether child views are focusable or clickable. Buttons and other interactive children can interfere with row touch handling and create state behavior that looks like a list highlight issue.
Keep Usability in Mind
Removing all feedback is sometimes the right visual choice, but it has a cost. Pressed-state feedback helps users understand that their tap was registered. If you disable the highlight, consider whether another signal should remain, such as:
- opening the next screen immediately
- animating the touched content slightly
- showing a subtle custom background change instead of a full highlight
If the list is purely decorative and item taps are secondary, a transparent selector may be appropriate. If the list is the main interaction surface, completely removing feedback can make the interface feel unresponsive.
A Complete Example
Here is a simple activity setup that keeps click behavior but removes visible highlight:
The click still fires normally. Only the visual highlight is removed.
Common Pitfalls
The most common mistake is changing the item view background in the adapter and expecting that to override the ListView selector. Another is setting a transparent listSelector but forgetting that the row layout itself may still have a pressed-state drawable or ripple. Developers also sometimes remove all feedback without considering usability, which makes taps feel broken even though the click handler is working. A final issue is confusing row selection state with focusable child views that intercept touches and create different visual behavior.
Summary
- '
ListViewhighlight is usually controlled by the selector, not by the click handler.' - Use
android:listSelector="@android:color/transparent"to remove the visible highlight quickly. - Use a custom selector drawable when you want explicit control over pressed and focused states.
- If highlight remains, inspect the row layout background and any clickable child views.
- Disabling feedback is easy technically, but make sure the UI still feels responsive to the user.

