Android/Kotlin Series: Make your Popup Menu Style Great Again

Leo N
2 min readJul 6, 2019

Static library support version of the framework’s PopupMenu. Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework SDK documentation for a class overview.

How we change style of popup menu?

  1. Firstly, we have this popup

It’s seemly good but you can see the text font, it’s so different from others, it will make your app does not professional and then you want to change style? It possible to change pop-up menu style from default black text on white background to dark background without applying style to the whole activity (which breaks your UI)?

2. What we expect?

3. How we do that?

  • Making your style
<style name="BasePopupMenu" parent="Widget.AppCompat.PopupMenu">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_gravity">center</item>
<item name="android:layout_height">wrap_content</item>
<item…

--

--

Leo N
Leo N

Written by Leo N

🇻🇳 🇸🇬 🇲🇾 🇦🇺 🇹🇭 Engineer @ GXS Bank, Singapore | MSc 🎓 | Technical Writer . https://github.com/nphausg

No responses yet