友盟自定义分享到朋友圈只显示图片

友盟分享总结:

case wechat_friend:
    sp.setPlatform(sharePlatForm.media);
    sp.withTitle(shareModel.getTitle());
    sp.withText(TextUtils.isEmpty(shareModel.getInfo()) ? shareModel.getTitle() : shareModel.getInfo());
    sp.withMedia(new UMImage(activity, shareModel.getImg()));
    sp.withTargetUrl(shareModel.getUrl());
    break;
case qq_friend:
    sp.setPlatform(sharePlatForm.media);
    sp.withTitle(shareModel.getTitle());
    sp.withText(TextUtils.isEmpty(shareModel.getInfo()) ? shareModel.getTitle() : shareModel.getInfo());
    sp.withMedia(new UMImage(activity, shareModel.getImg()));
    sp.withTargetUrl(shareModel.getUrl());
    break;
case weibo:
    sp.setPlatform(sharePlatForm.media);
    sp.withText((TextUtils.isEmpty(shareModel.getInfo()) ? shareModel.getTitle() : shareModel.getInfo()) + '\n' + shareModel.getUrl());
    sp.withMedia(new UMImage(activity, shareModel.getImg()));
    break;
case wechat_friend_circle:
    ShareContent shareContent=new ShareContent();
    shareContent.mTargetUrl=shareModel.getUrl();
    shareContent.mTitle=(TextUtils.isEmpty(shareModel.getTitle()) ? shareModel.getInfo() : shareModel.getTitle());
    sp.setShareContent(shareContent);
    sp.setPlatform(SHARE_MEDIA.WEIXIN_CIRCLE);
    sp.withMedia(new UMImage(activity, shareModel.getImg()));
    sp.withTargetUrl(shareModel.getUrl());
    break;
case qq_zone:
    sp.setPlatform(sharePlatForm.media);
    sp.withTitle(shareModel.getTitle());
    sp.withText(TextUtils.isEmpty(shareModel.getInfo()) ? shareModel.getTitle() : shareModel.getInfo());
    sp.withMedia(new UMImage(activity, shareModel.getImg()));
    sp.withTargetUrl(shareModel.getUrl());
    break;
case message:
    sp.setPlatform(sharePlatForm.media);
    sp.withText(shareModel.getTitle() + (TextUtils.isEmpty(shareModel.getInfo()) ? "" : '\n' + shareModel.getInfo()) + '\n' + shareModel.getUrl());
    break;




请注意朋友圈分享一定要这样的,不然就会丢失text

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页