Reputation: 1093
I have an app with a simple listview and context menu in it. pre android 7, everything looks ok:
when clicking an item at the bottom of the list:
when clicking an item at the top of the list:
But wit android 7...
when clicking an item at the bottom of the list:
when clicking an item at the top of the list:
Was there any change in the position of the context menu?
Upvotes: 9
Views: 2175
Reputation: 29
If anyone still has the same problem, just add this to your theme folder (v14)
<item name="android:overlapAnchor">true</item>
Upvotes: 4
Reputation: 1093
I found a solution for this somewhere (can't remember where). The problem is between the new context menu and the Holo themes.
Solution Details:
I added a style in values-v24 folder that looks like:
<resources>
<style name="ContextPopupMenuStyleLight" parent="@android:style/Widget.Holo.Light.PopupMenu">
<item name="android:overlapAnchor">true</item>
</style>
<style name="ContextPopupMenuStyleDark" parent="@android:style/Widget.Holo.PopupMenu">
<item name="android:overlapAnchor">true</item>
</style>
<style name="AppTheme" parent="AppTheme.Common" >
<item name="android:contextPopupMenuStyle">@style/ContextPopupMenuStyleLight</item>
</style>
Then, in my default styles.xml I used a style called
AppTheme.Common
That defines all my app style, and an empty style called
<style name="AppTheme" parent="AppTheme.Common" />
and I used that empty style as the default app style. This way, on version > 24, the app uses this extra item regarding context menu overlap anchor to fix the issue (bringing context menu to what they looked like before API 24)
Upvotes: 13