Search code examples
androidandroid-actionbaractionbarsherlockshareactionprovider

Android Sherlock Action - ShareActionProvider Icon


I am using ShareActionProvider in my Sherlock ActionBar. I want to change the icon but not able to do so.

XML

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/action_share"
        android:actionProviderClass="com.actionbarsherlock.widget.ShareActionProvider"
        android:icon="@drawable/ic_menu_share"
        android:showAsAction="always"
        android:title="Search"/>

</menu>

Even after Specify the Icon it takes the Default Icon from the Holo Light Theme

Is there any way to reference the Icon and force change it via Program ?


Solution

  • When I am looking to customize the action bar, usually the first place I look is the ActionBarSherlock themes and styles.

    I found that the Sherlock theme uses the "actionModeShareDrawable" as found in theme.xml file.

    Try changing your theme to include the "actionModeShareDrawable" item directly.

    <style name="Theme.MyApp" parent="Theme.Sherlock.Light">
        <item name="actionModeShareDrawable">@drawable/ic_action_share</item>
    </style>