问题
I am using ActionBarSherlock and have implemented ShareActionProvider.
When a user selects an app to share content with, eg Twitter, the actionbar displays a Twitter icon next to the Share button icon. This stays there forever.
Does anybody know how to disable the application icon from appearing next to the Share button?
回答1:
Found the answer:
Implement OnShareTargetSelectedListener and set it on the ShareActionProvider
public void onCreateOptionsMenu(Menu menu){
....
actionProvider.setOnShareTargetSelectedListener(this);
....
@Override
public boolean onShareTargetSelected(ShareActionProvider source,
Intent intent) {
context.startActivity(intent);
// started activity ourself to prevent search history
return true;
}
回答2:
The top target is featured in the action bar. This is the behavior of the widget as it exists in Android.
If you do not want this behavior copy the sources into your app and modify its behavior to never display the top target icon.
来源:https://stackoverflow.com/questions/11067829/actionbarsherlock-share-content-icon-issue