Can't you make Click Event in KeyUp, Down format for the first item in ListView?
This event while you're pressing it, and this event when you hit your hand.
It's like...
There was an OnKey, so I tried to use it.
I don't know if this is part of the entire list view. What did I do wrong?
It didn't work out.<
listview keyup
The desired listener in the adapter's view holder, for example View.After implementing the OnKeyListener interface, set the view listener.
class ItemViewHolder extends RecyclerView.ViewHolder implements View.OnKeyListener {
private TextView mTableNumber;
ItemViewHolder(@NonNull View itemView) {
super(itemView);
itemView.setOnKeyListener(this);
mTableNumber = itemView.findViewById(R.id.text_table_check_table_no);
}
void bindViewHolder(TableCheck item) {
String newline = "";
StringBuilder sb = new StringBuilder();
for(TableItem tableItem : item.getTableItemList()) {
sb.append(newline).append('·').append(tableItem.getItemName());
newline = "\n";
}
mTableNumber.setText(String.valueOf(item.getTableNo()));
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
return false;
}
}
You said you wanted to put a listener only on the first item, but when you bind the view holder from the adapter, you can transfer it to the position as a parameter, put the position variable in the view holder, and process it as a conditional statement.
© 2024 OneMinuteCode. All rights reserved.