ListItemBackgroundResolver
open class ListItemBackgroundResolver
kotlin.Any | |
↳ | androidx.car.utils.ListItemBackgroundResolver |
A utility class that will set the current background for a View that represents an card entry in a list. The class will set the background depending on the position of the card within the list.
Summary
Public methods | |
---|---|
open static Unit |
setBackground(view: View!, currentPosition: Int, totalItems: Int) Sets the background on the given view so that the combination of all items looks like a rectangle with rounded corner. |
Public methods
setBackground
open static fun setBackground(view: View!, currentPosition: Int, totalItems: Int): Unit
Sets the background on the given view so that the combination of all items looks like a rectangle with rounded corner. The view is assumed to have a non-rounded corner outline.
The view will be set with rounded backgrounds if it is the only card within the list. Or if it is the first or last view, it will have the top or bottom corners rounded respectively.
Parameters | |
---|---|
view |
View!: The view whose background to set. |
currentPosition |
View!: The current position of the View within the list. This value should be 0-based. |
totalItems |
View!: The total items within the list. |