Removing a line or separator between the action bar and the main screen in Android

How to remove a line or separator between the action bar and the main screen? How can I change the color of this separator in android? Thanks in advance.

+4
source share
5 answers

After more effort, I can find my perfect theme.

  • First of all, I have to say that Theme.Holo.Light has a shadow at the bottom of the action bar, if you want it not to shadow, you should use Theme.Holo.
  • After changing the style, you must change other settings for yourself, as a code.

    <resources> <style name="AppTheme" parent="android:Theme.Holo"> <item name="android:actionBarStyle">@style/AppTheme.ActionBar</item> <item name="android:background">#ff0000</item> <item name="android:colorBackground">#ff0000</item> </style> <style name="AppTheme.ActionBar" parent="android:Widget.ActionBar"> <item name="android:background">#ff0000</item> </style> </resources> 
  • This code is below for my last call that I found how to solve it.

     <resources> <style name="AppTheme" parent="android:Theme.Holo.Light"> <item name="android:actionBarStyle">@style/AppTheme.ActionBar</item> <item name="android:background">#ff0000</item> <item name="android:colorBackground">#ff0000</item> </style> <style name="AppTheme.ActionBar" parent="android:Widget.ActionBar"> <item name="android:background">#ff0000</item> </style> </resources> 
  • Below is the image for the first code. If you notice that there is no separator.

enter image description here

  • And below is the image for the second code.

enter image description here

+5
source

Just insert the windowContentOverlay attribute into your theme. It's too easy.

 <style name="AppTheme" parent="android:Theme.Holo.Light"> <!-- Customize your theme here. --> <item name="android:windowContentOverlay">@null</item> </style> 
+13
source

If you are using AppCompat, you need to set parent = "Theme.AppCompat" and not "Theme.AppCompat.Light" (the same for ActionBar) :)

For example: @ Style / MyActionBar true @ Style / MyActionBar true

 <style name="MyActionBar" parent="Base.Widget.AppCompat.ActionBar"> <item name="android:background">@android:color/transparent</item> <!--For compatibility--> <item name="background">@android:color/transparent</item> </style> 
+1
source

In your styles.xml file, find your AppTheme style and add the following style to it

  <item name="android:actionBarDivider">@android:color/transparent</item> 

like this

 <style name="AppTheme" parent="Theme.AppCompat.Light"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:fontFamily">@font/roboto</item> <item name="android:actionBarDivider">@android:color/transparent</item> </style> 

in fact, it sets a transparent divider background between the activity window and the action bar.

0
source

None of these solutions helped me. I ended up adding this code to onCreate() my MainActivity :

 actionBar = getSupportActionBar(); actionBar.setElevation(0); 
0
source

Source: https://habr.com/ru/post/977682/


All Articles