ItemDetailsLookup
public
abstract
class
ItemDetailsLookup
extends Object
java.lang.Object
|
↳ |
androidx.recyclerview.selection.ItemDetailsLookup<K>
|
The Selection library calls getItemDetails(MotionEvent)
when it needs
access to information about the area and/or ItemDetailsLookup.ItemDetails
under a MotionEvent
.
Your implementation must negotiate
ViewHolder
lookup with the
corresponding RecyclerView instance, and the subsequent conversion of the ViewHolder
instance to an ItemDetailsLookup.ItemDetails
instance.
Example
final class MyDetailsLookup extends ItemDetailsLookup {
private final RecyclerView mRecyclerView;
MyDetailsLookup(RecyclerView recyclerView) {
mRecyclerView = recyclerView;
}
public @Nullable ItemDetails getItemDetails(@NonNull MotionEvent e) {
View view = mRecyclerView.findChildViewUnder(e.getX(), e.getY());
if (view != null) {
ViewHolder holder = mRecyclerView.getChildViewHolder(view);
if (holder instanceof MyHolder) {
return ((MyHolder) holder).getItemDetails();
}
}
return null;
}
}
Summary
Nested classes |
class |
ItemDetailsLookup.ItemDetails<K>
An ItemDetails implementation provides the selection library with access to information
about a specific RecyclerView item.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public constructors
ItemDetailsLookup
public ItemDetailsLookup ()
Public methods
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples/Code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-30 UTC.