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?
 

Yuri Cinesi

Member
Licensed User
Here's everything.
 

Attachments

  • API 25.jpg
    API 25.jpg
    11.4 KB · Views: 317
  • API 22.png
    API 22.png
    33.3 KB · Views: 330
  • ACPopUpMenuBug.zip
    7.1 KB · Views: 229
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
It looks like this Android 5.0 bug: https://stackoverflow.com/questions...ollipop-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>
)
 
Upvote 0
Top