I have CardScrollViewone in which there are several elements, and I would like to be able to pull out the menu on the element, like the built-in timeline.
I know that a map cannot be tied to a specific menu, so I have a menu prepared at the activity level.
However, it looks like something similar to all the onKeyDown events.
public class HostsView extends CardScrollView {
private String TAG = "HostsView";
private HostsCardScrollAdapter cards;
private Activity parent;
public HostsView(Activity parent, HostDatabase hostDb) {
super(parent);
cards = new HostsCardScrollAdapter(parent);
this.setAdapter(cards);
this.activate();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.d(TAG, "Key event " + event.toString());
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
parent.openOptionsMenu();
return true;
}
return super.onKeyDown(keyCode, event);
}
}
source
share