ActionBarSherlock - 共享内容的图标问题图标、内容、问题、ActionBarSherlock

2023-09-12 02:52:53 作者:竹隐寒烟

我使用 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; 
 }