I'm working on an AndroidTV app, using the Leanback library.
I've got a few HorizontalGridView
(which is an extension of RecyclerView) working correctly, however, scrolling through them by pressing and holding right|left button makes it scroll incredibly fast, too fast!
How can I slow down the speed at which it scrolls by leaving the button pressed?
Do not listen your key event for some milli-time in your activity.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
long current = System.currentTimeMillis();
boolean res = false;
if (current - mLastKeyDownTime < 300) {
res = true;
} else {
res = super.onKeyDown(keyCode, event);
mLastKeyDownTime = current;
}
return res;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With