2

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 ?

Harsha M V
  • 54,075
  • 125
  • 354
  • 529

2 Answers2

2

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>
suresh cheemalamudi
  • 6,190
  • 11
  • 49
  • 67
1

Might be R.java file is not updated after your change So clean the workspace or re-build the project.

Gupta
  • 11
  • 1