如何在保留共享图标的同时摆脱具有消息传递应用程序的小盒子?
<item
android:id="@+id/share"
app:actionProviderClass="android.support.v7.widget.ShareActionProvider"
android:title="share"
app:showAsAction="always" />
答案 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"));