2

I have been found in forum, how remove the border bottom in Android action bar, but no method (setElevation(0) and <item name="android:windowContentOverlay">@null</item>) work with my example.

Always have a border.

enter image description here

Thanks.

RESOLVED:

I did it!! Sorry, I was confusing because I thought the border/shadow was of ActionBar theme, but no, It was of Activity theme. I did it with "@null" added in style of the activity Thanks everybody for your help.

JMR
  • 41
  • 2
  • 11

2 Answers2

4

You can remove elevation/shadow on ActionBar by below codes :

By xml :

 <android.support.design.widget.AppBarLayout
            android:id="@+id/appBarLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:elevation="0dp">
            ...
</android.support.design.widget.AppBarLayout>

By Java :

To remove elevation using java code use only one below line... getSupportActionBar().setElevation(0);

or,

 getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
 getSupportActionBar().setElevation(0);
Abhishek kumar
  • 4,347
  • 8
  • 29
  • 44
0
<!-- Theme without ActionBar shadow (inherits main theme) -->
    <style name="MyNoActionBarShadowTheme" parent="MyAppTheme">
        <item name="windowContentOverlay">@null</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>

Use this style in styles.xml file

Sai's Stack
  • 1,345
  • 2
  • 16
  • 29
  • Opponent already mentioned that **@null** not working. – Niranj Patel Apr 04 '18 at 06:57
  • Doesn't work because show the next error with @null: No resource found that matches the given name: attr 'windowContentOverlay'. – JMR Apr 04 '18 at 07:07
  • @JMR try this given style programaticaly in activity `setTheme(R.style.MyNoActionBarShadowTheme);` add this line as first line of onCreate method – Vidhi Dave Apr 04 '18 at 07:13