How to remove the border for Share button in Action Bar?

1.2k views Asked by At

Have a look at the picture

enter image description here

This is how Share button looks like in action bar.

Here's the code I use in menu xml file:

   <item
        android:id="@+id/menu_item_share"
        android:showAsAction="ifRoom"
        android:title="Share"
        android:actionProviderClass=
            "android.widget.ShareActionProvider" />

Is it possible to remove that border or change its color?

2

There are 2 answers

1
SpyZip On BEST ANSWER

You need to use custom background.

This might help: https://developer.android.com/training/basics/actionbar/styling.html

5
Hugo Gresse On

Here is a more complet message :

In your style, add

<style name="_MidipileTheme" parent="android:Theme.Holo.Light">
    <item name="android:actionBarItemBackground">@android:color/transparent</item>
</style>

drawable/action_background

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@color/background_actionBar"/>
</shape>

@color/background_actionBar is your custom background. For me, it's the same background color as actionBar background drawable.