我使用 ActionBarSherlock
和已实施 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?
找到了答案:
实施OnShareTargetSelectedListener并在其设置 ShareActionProvider
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;
}