How to make the overflow popup menu avoid obstructing the action bar?

前端 未结 1 834
庸人自扰
庸人自扰 2021-02-15 02:02

Background

On my app, when I\'ve updated to the new support library and also tried on Lollipop, I\'ve noticed a weird issue: when clicking on the overflow button of th

相关标签:
1条回答
  • 2021-02-15 02:25

    If you're using ActionBarActivity, you'll need to override the appcompat version of the overflow menu style along with the appcompat versions of the popup attributes, where applicable.

    <resources>
        <style name="AppBaseTheme" parent="Theme.AppCompat.Light" />
    
        <style name="AppTheme" parent="AppBaseTheme">
            <item name="actionOverflowMenuStyle">@style/OverflowMenu</item>
        </style>
    
        <style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
            <!-- Required for pre-Lollipop. -->
            <item name="overlapAnchor">false</item>
    
            <!-- Required for Lollipop. -->
            <item name="android:overlapAnchor">false</item>
        </style>
    
    </resources>
    
    0 讨论(0)
提交回复
热议问题