Skip to content

Instantly share code, notes, and snippets.

@RedLann
Last active March 10, 2023 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RedLann/bfaffc06eb0f571234c6e46b697d633b to your computer and use it in GitHub Desktop.
Save RedLann/bfaffc06eb0f571234c6e46b697d633b to your computer and use it in GitHub Desktop.
@Override
public View focusSearch(View focused, int direction) {
switch (direction) {
case FOCUS_DOWN:
if (mContainer.hasFocus())
return focused;
else if (mTopMenu.hasFocus()) {
mLastFocused = mContainer;
return mContainer;
} else
return null;
case FOCUS_UP:
if (mContainer.hasFocus()) {
mLastFocused = mTopMenu;
return mTopMenu;
}
return null;
case FOCUS_RIGHT:
case FOCUS_LEFT:
return focused;
default:
return super.focusSearch(focused, direction);
}
}
@akshaytaru
Copy link

what is the mContainer? Let's say I have created a custom LinearLayout as parent in which I will add this code. And the recycleView would be child of the Custom LinearLayout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment