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

霸气de小男生 提交于 2019-12-20 03:24:15

问题


Have a look at the picture

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?


回答1:


You need to use custom background.

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




回答2:


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.



来源:https://stackoverflow.com/questions/20494959/how-to-remove-the-border-for-share-button-in-action-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!