I'm struggling with the following situation:
I create the context menus in ListViews by overriding the onCreateContextMenu method from the listview
myListView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
AdapterContextMenuInfo ctxmenu = (AdapterContextMenuInfo)menuInfo;
int pos = ctxmenu.position;
mLastEmpresaSelected = m_empresas.get(pos);
menu.setHeaderTitle("Title Header");
menu.add(Menu.NONE,myItem1, 1, "Item 1");
menu.add(Menu.NONE,myItem1, 2, "Item 2");
}
});
Now this works fine in previous Android versions, but in Android 7 i get a small menu at the bottom of the screen which must be scrolled.
This is not very practical, so I'm trying to make a context menu like the ones I was used to.
I'm currently using api level 10 (Android 2.3.3 - Gingerbread)
I've seen a workaround in this place:
but then i get these warnings:
error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Widget.Holo.Light.PopupMenu'
error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'
error: Error: No resource found that matches the given name: attr 'android:contextPopupMenuStyle'
error: Error: No resource found that matches the given name: attr 'android:overlapAnchor'.
I understand that in api level 10 the theme does not exist. I'm trying to find a workarround without changing the target API.
Any thoughts?
Thanks in advance!