change the three dots action bar overflow menu icon in android

To override the icon, we would need a new theme that extends the Holo or HoloLight or… For my app, since I support changing theme, i would need 2 custom theme.
These code can be added in the res/values/xxx.xml, i just put in my strings.xml

    <style name="MyHoloTheme" parent="@android:style/Theme.Holo">
        <item name="android:actionOverflowButtonStyle">@style/OverFlow</item>

    <style name="MyHoloLightTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionOverflowButtonStyle">@style/OverFlow</item>

    <style name="OverFlow" parent="@android:style/Widget.Holo.ActionButton.Overflow">
        <item name="android:src">@drawable/video_icon</item>

if you just have 1 theme, just set the custom theme in the activity definition.

        <activity android:theme="@style/MyHoloLightTheme"

I need 2 themes, if you also need 2 or more, just switch it in the code:

        SharedPreferences sharedPreferences = getSharedPreferences(getString(R.string.app_pref), MODE_PRIVATE);
        if (sharedPreferences.getBoolean(getString(R.string.night_mode_pref_key), true)) {
        } else {

See this post for more about using sharedPreference for user settings.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s