Analyze Android ContextMenu
This article based on AOSP 9.0. ContextMenu is very useful UI item to show menu based on your event context, for example showing power menu around of power button when clicking it. This article will analyze the implementation of Android’s ContextMenu to provide information to implement custom floating context window. How to use ContextMenu The common use of ContextMenu is override the Activity’s onCreateContextMenu @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle("Context Menu"); menu.add(....); } And then use registerForContextMenu to register the ContextMenu for...