When using listView to develop, you need to click on the item on the listView. Sometimes we don’t need to highlight the entire item, but only the part that you click. At this time, you need to implement an interface SelectionBoundsAdjuster and override the adjustListItemSelectionBounds method.
@Override public void adjustListItemSelectionBounds(Rect bounds) { if (mAdjustSelectionBoundsEnabled) { bounds.top += mBoundsWithoutHeader.top; bounds.bottom = bounds.top + mBoundsWithoutHeader.height(); bounds.left = mBoundsWithoutHeader.left; bounds.right = mBoundsWithoutHeader.right; } }
By reassigning bounds, the desired click area can be highlighted