-1

I am designing an application. I had designed the actionbar and under the action I designed a Top bar. Both bars are of color white, so I wanted to place a divider between these bars.

I tried many solutions that are present in this site. None of them worked for me.

This is one of the solution I tried and top bar I created in a .java class

All I need is a divider between main action bar and top bar.

    <style name="MyCustomTheme" parent="Theme.AppCompat.Light">
    <item name="android:actionBarStyle">@style/MyActionBarTheme</item>
    <!-- <item name="android:divider">@color/dividercolor</item> -->
    <item name="android:showDividers">beginning</item>
</style>

<style name="MyActionBarTheme" parent="Widget.AppCompat.Light.ActionBar">
    <item name="android:background">#FFFFFFFF</item>
    <!-- <item name="android:divider">@drawable/divider</item> -->
</style>
Paul Roub
  • 36,322
  • 27
  • 84
  • 93
no1
  • 128
  • 11

1 Answers1

0

Solution 1:

Use an image with plain white background and a colored(depends on what you like) border at the bottom, and set this image as the background of your ActionBar. Or use an image with plain white background and colored border on top, and set it as the background of your TopBar.

Solution 2:

You can just add a view on top of your Top bar in xml and set its attributes like this.

<View
    android:layout_width="fill_parent"
    android:layout_height="1dp" //adjust this for thicker divider.
    android:background="the color you want" />

<TopBar
    //TopBar attributes 
</TopBar>
JLT
  • 3,052
  • 9
  • 39
  • 86