Android: Change color of line below ActionBar

I want to change the color of the orange line below the ActionBar.

  • Android - SMS Broadcast receiver
  • Widget.AppCompat.Button colorButtonNormal shows gray
  • Canvas.drawTextOnPath(…) not working on Lollipop
  • Eclipse Hangs in DDMS post-create init
  • Camera with custom shutter sound
  • Image segmentation by background color - OpenCV Android
  • I’ve tried a few things but nothing has helped so far.

    The current theme on my Galaxy S2 is an orange theme.
    So changing the theme, also changes the line.
    But I donĀ“t know how to get access to that line, in order to change the color.

    Related posts:

    start application knowing package name
    How to add a button control to an android xml view at runtime?
    Best approach to pass data from web view to native app (Windows, iOS & Android)
    Remove background drawable programmatically in Android
    Android - How to take screenshot programatically
    Style SnackBar in theme app
  • Propagation delay when changing In-app Product price & description in Google Play developer console
  • Unable to resolve superclass of Landroid/support/v4/app/FragmentActivity
  • Android TextWatcher.afterTextChanged vs TextWatcher.onTextChanged
  • Monitor network activity in Android Phones
  • Getting the android context in an adapter
  • Can't put double SharedPreferences
  • 4 Solutions collect form web for “Android: Change color of line below ActionBar”

    You can use This code for achieving your purpose.


    <?xml version="1.0" encoding="utf-8"?>
            <shape android:shape="rectangle">
                <solid android:color="#ff0000" />
        <item android:bottom="5dp">
            <shape android:shape="rectangle">
                <solid android:color="#ffffff" />


        <style name="AppTheme" parent="android:Theme.Holo">
            <item name="android:actionBarStyle">@style/AppTheme.ActionBar</item>
            <item name="android:background">#ffffff</item>
            <item name="android:colorBackground">#ffffff</item>
        <style name="AppTheme.ActionBar" parent="android:Widget.ActionBar">
            <item name="android:background">@drawable/background</item>

    These codes are suitable when you have not any options menu like image shows in question, if you have options menu you must customize your option menu items background.

    If you have Option menu below code is suitable:

        <style name="AppTheme" parent="android:Theme.Holo.Light">
            <item name="android:actionBarStyle">@style/AppTheme.ActionBar</item>
            <item name="android:popupMenuStyle">@style/AppTheme.PopUpMenu</item>
        <style name="AppTheme.ActionBar" parent="android:Widget.ActionBar">
            <item name="android:background">@drawable/background</item>
        <style name="AppTheme.PopUpMenu" parent="android:Widget.Holo.Light.ListPopupWindow">
            <item name="android:popupBackground">@drawable/background</item>

    There is A simpler way than this (Creating Bunch of Styles).
    Refering to this . Just set


    This will Remove the line from Your Action Bar

    I used this ^_^ and it is 100% working:

        Drawable res = getResources().getDrawable(R.drawable.ab_transparent_example);

    and JUST USE THIS .9.png

    In my case, in my application, I used the Holo theme.

    <style name="AppTheme" parent="android:Theme.Holo">

    Background toolbar is set through the property.

    <style name="AppTheme" parent="android:Theme.Holo">
        <item name="android:actionBarStyle">@style/ActionBarStyle</item>
    <style name="ActionBarStyle" parent="@android:style/Widget.Holo.ActionBar">
        <item name="android:background">@drawable/action_bar_background</item>

    Standard Holo action bar background is nine-patch drawable like this:

    nine patch drawable

    So, if you want to change the color of the bottom line, you need to create a new nine-patch drawable.
    Create Resizable Bitmaps (9-Patch files)

    Put the file in the folder drawable (example drawable-xxhdpi) and specify the path to the file in the theme.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.