Android transparent status bar and actionbar

I’m developing an app that needs to look similar in all devices with >= API14 when it comes to actionbar and statusbar customization. I’ve finally found a solution and since it took a bit of my time I’ll share it to save some of yours. We start by using an appcompat-21 dependency. Transparent Actionbar: values/styles.xml: … Read more

Changing the background drawable of the searchview widget

Intro Unfortunately there’s no way to set SearchView text field style using themes, styles and inheritance in XML as you can do with background of items in ActionBar dropdown. This is because selectableItemBackground is listed as styleable in R.stylable, whereas searchViewTextField (theme attribute that we’re interested in) is not. Thus, we cannot access it easily … Read more

Remove shadow below actionbar

What is the style item to make it disappear? In order to remove the shadow add this to your app theme: <style name=”MyAppTheme” parent=”android:Theme.Holo.Light”> <item name=”android:windowContentOverlay”>@null</item> </style> UPDATE: As @Quinny898 stated, on Android 5.0 this has changed, you have to call setElevation(0) on your action bar. Note that if you’re using the support library you … Read more

Failed to load AppCompat ActionBar with unknown error in android studio

The solution to this problem depends on the version of the Android support library you’re using: Support library 26.0.0-beta2 This android support library version has a bug causing the mentioned problem In your Gradle build file use: compile ‘com.android.support:appcompat-v7:26.0.0’ with: buildToolsVersion ‘26.0.0’ and classpath ‘com.android.tools.build:gradle:3.0.0-alpha8’ everything should work fine now. Library version 28 (beta) These … Read more

Full Screen Theme for AppCompat

When you use Theme.AppCompat in your application you can use FullScreenTheme by adding the code below to styles. <style name=”Theme.AppCompat.Light.NoActionBar.FullScreen” parent=”@style/Theme.AppCompat.Light.NoActionBar”> <item name=”android:windowNoTitle”>true</item> <item name=”android:windowActionBar”>false</item> <item name=”android:windowFullscreen”>true</item> <item name=”android:windowContentOverlay”>@null</item> </style> and also mention in your manifest file. <activity android:name=”.activities.FullViewActivity” android:theme=”@style/Theme.AppCompat.Light.NoActionBar.FullScreen” />

How to customize the back button on ActionBar

The “up” affordance indicator is provided by a drawable specified in the homeAsUpIndicator attribute of the theme. To override it with your own custom version it would be something like this: <style name=”Theme.MyFancyTheme” parent=”android:Theme.Holo”> <item name=”android:homeAsUpIndicator”>@drawable/my_fancy_up_indicator</item> </style> If you are supporting pre-3.0 with your application be sure you put this version of the custom theme … Read more

How to change the background color of Action Bar’s Option Menu in Android 4.2?

In case people are still visiting for a working solution, here is what worked for me:– This is for Appcompat support library. This is in continuation to ActionBar styling explained here Following is the styles.xml file. <resources> <!– Base application theme. –> <style name=”AppTheme” parent=”Theme.AppCompat.Light”> <!– This is the styling for action bar –> <item … Read more