How to force use of overflow menu on devices with menu button

You can also use this little hack here: try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField(“sHasPermanentMenuKey”); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ignored) { } Good place to put it would be the onCreate-Method of your Application class. It will force the App to show the overflow … Read more

How to Set a Custom Font in the ActionBar Title?

You can do this using a custom TypefaceSpan class. It’s superior to the customView approach indicated above because it doesn’t break when using other Action Bar elements like expanding action views. The use of such a class would look something like this: SpannableString s = new SpannableString(“My Title”); s.setSpan(new TypefaceSpan(this, “MyTypeface.otf”), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // … Read more

ActionBar text color

Ok, I’ve found a better way. I’m now able to only change the color of the title. You can also tweak the subtitle. Here is my styles.xml: <?xml version=”1.0″ encoding=”utf-8″?> <resources> <style name=”MyTheme” parent=”@android:style/Theme.Holo.Light”> <item name=”android:actionBarStyle”>@style/MyTheme.ActionBarStyle</item> </style> <style name=”MyTheme.ActionBarStyle” parent=”@android:style/Widget.Holo.Light.ActionBar”> <item name=”android:titleTextStyle”>@style/MyTheme.ActionBar.TitleTextStyle</item> </style> <style name=”MyTheme.ActionBar.TitleTextStyle” parent=”@android:style/TextAppearance.Holo.Widget.ActionBar.Title”> <item name=”android:textColor”>@color/red</item> </style> </resources>

How do I change the background color of the ActionBar of an ActionBarActivity using XML?

As per documentation – “You can control the behaviors and visibility of the action bar with the ActionBar APIs, which were added in Android 3.0 (API level 11).” So, ActionBar will not work for your target environment which is at API level 10 (Android 2.3.3). Just in case, if you target for minimum API level … Read more

This Activity already has an action bar supplied by the window decor

I think you’re developing for Android Lollipop, but anyway include this line: <item name=”windowActionBar”>false</item> to your theme declaration inside of your app/src/main/res/values/styles.xml. Also, if you’re using AppCompatActivity support library of version 22.1 or greater, add this line: <item name=”windowNoTitle”>true</item> Your theme declaration may look like this after all these additions: <!– Base application theme. –> … Read more