All the Android experts,
I'm working on Android TV app. I face problem on Dpad navigation. i would like to stop auto Dpad navigate while KeyDown UP and DOWN.
i wrote a listener on a focusable TextView, if TextView on key UP then scroll UP the listview, and key DOWN scroll DOWN.
but the below code seen failed to scroll my listview, my focus move to other focus point while i press DOWN.
Is there any solution that i can override the auto focus navigation? i would like my TextView ignore the auto navigation to next focus while i press key UP and DOWN.
Thank you.
textView.setOnKeyListener(new View.OnKeyListener(){
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch(keyCode) {
case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_PAGE_UP:
listview_scrollUP();
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_PAGE_DOWN:
listview_scrollDOWN();
break;
}
}
return false;
}
});