How to change color of the overflow button in the main toolbar?

When the main toolbar is full, some actions could end up in the overflow menu. Overflow button has white color by default. We’ll explain how to change this default color to better fit your theme below.

Change Color Programmatically

Overflow button color can be changed programmatically inside your activity:

Copy
1
2
val mainToolbar = findViewById(R.id.pspdf__toolbar_main) as MainToolbar
mainToolbar.overflowIcon?.colorFilter = PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP)

Change Color In Theme

You can also change the overflow button color in your activity theme:

Copy
1
2
3
4
5
6
7
8
9
<!-- Set custom style for overflow button in your theme. -->
<item name="android:actionOverflowButtonStyle">@style/OverflowButtonStyle</item>

....

<!-- Extend the overflow button style with different tint color. -->
<style name="OverflowButtonStyle" parent="Widget.AppCompat.ActionButton.Overflow">
    <item name="tint">@color/custom_overflow_button_color</item>
</style>

If you are not yet using custom theme, refer to Defining a Custom Theme guide.