ActionBarSherlock - Share Content icon issue

前提是你 提交于 2019-12-10 09:59:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!