删除最新的共享应用

时间:2016-10-28 06:21:34

标签: android xml android-intent share-intent

如何在保留共享图标的同时摆脱具有消息传递应用程序的小盒子?

Share intent with most recent app

<item
    android:id="@+id/share"
    app:actionProviderClass="android.support.v7.widget.ShareActionProvider"
    android:title="share"
    app:showAsAction="always" />

1 个答案:

答案 0 :(得分:1)

如果您不想显示最近的分享应用,请删除ShareActionprovider。 并在菜单中添加一个图标,并像这样处理共享操作

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 
sharingIntent.setType("text/plain");
String shareBody = "Here is the share content body";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Share via"));