Android Question ACPopupMenu black border on API level 22

Yuri Cinesi

Member
Licensed User
I'm using appcompat to create a popup menu using ACPopupMenu, with Theme.AppCompat.Light.NoActionBar as the base theme I've then modified.
On android 5.0.1 (API 22) however there is a strange black border around the popup menu when it's shown. The same thing does not happen on 7.1 (API 25) and the menu is displayed correctly.
Any ideas on how to remove the black border?
 

Erel

Administrator
Staff member
Licensed User
Can you post a screenshot and a small project that demonstrates it?
 

Erel

Administrator
Staff member
Licensed User
It looks like this Android 5.0 bug: https://stackoverflow.com/questions/29616794/artifacts-on-lollipop-popup-menu-when-using-dark-background

Try it with this style:
B4X:
CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
        <item name="windowNoTitle">true</item>
       <item name="windowActionBar">false</item>
       <item name="textAppearanceLargePopupMenu">@style/myPopupMenuTextAppearanceLarge</item>
       <item name="android:textAppearanceLargePopupMenu">@style/myPopupMenuTextAppearanceLarge</item>
       <item name="textAppearanceSmallPopupMenu">@style/myPopupMenuTextAppearanceSmall</item>
       <item name="android:textAppearanceSmallPopupMenu">@style/myPopupMenuTextAppearanceSmall</item>
       <item name="popupMenuStyle">@style/myPopupMenuStyle</item>
       <item name="android:popupMenuStyle">@style/myPopupMenuStyle</item>
    </style>
     
   <style name="myPopupMenuStyle" parent="@style/Widget.AppCompat.Light.PopupMenu">
       <item name="android:popupBackground">@drawable/my_popup_bg</item>
   </style>
   <style name="myPopupMenuTextAppearanceSmall" parent="@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Small">
       <item name="android:textColor">#FFFFFF</item>
   </style>
   <style name="myPopupMenuTextAppearanceLarge" parent="@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Large">
       <item name="android:textColor">#FFFFFF</item>
   </style>
</resources>
)
CreateResource(drawable, my_popup_bg.xml,
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
    <corners android:radius="2dp" />
    <solid android:color="#002C74" />
</shape>
)
 
Top