The menu of my application appears as follows
and I need the menu items to appear just where in the limit of the action bar as it appears in the following image
Any idea how to do it.
Asked
Active
Viewed 1,277 times
2
Mickey Mouse
- 107
- 1
- 11
2 Answers
0
Two way to achieve that one use the custom style at v21
<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<!-- Required for pre-Lollipop. -->
<item name="overlapAnchor">false</item>
<item name="android:dropDownVerticalOffset">-4.0dp</item>
<!-- Required for Lollipop. -->
<item name="android:overlapAnchor">false</item>
<item name="android:dropDownVerticalOffset">4.0dp</item>
</style>
or use the android theme
android:theme="@android:style/Theme.Holo.Light"
Reference How I can place overflow menu below toolbar instead of overflow menu to overlaps the app bar
Community
- 1
- 1
Shubhank Gupta
- 833
- 2
- 15
- 35
0
In your
values/styles.xmladdOverflowMenustyle as:<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow"> <item name="overlapAnchor">false</item> <item name="android:dropDownVerticalOffset">-4dp</item> </style>In your
values-21/styles.xmladdOverflowMenustyle as:<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow"> <item name="android:overlapAnchor">false</item> <item name="android:dropDownVerticalOffset">4dp</item> </style>- Finally, in your
values/styles.xmlmain style useOverflowMenustyle asactionOverflowMenuStyle.
values/styles.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="actionOverflowMenuStyle">@style/OverflowMenu</item>
</style>
<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<item name="overlapAnchor">false</item>
<item name="android:dropDownVerticalOffset">4.0dp</item>
</style>
</resources>
Ferdous Ahamed
- 21,438
- 5
- 52
- 61