Android mob(sharesdk)微信分享/微信朋友圈分享/QQ分享/QQ空间分享/新浪微博分享(自定义)

2023-11-17

使用场景

H5混合开发转Android 原生开发,之前也是用的友盟分享、微信原生、QQ原生、微博原生分享,今天这个项目恰好是用的mob的sharesdk分享,老实说,还是第一次使用,一开始接手项目的时候,还以为mob是个后台。

来一张效果图:

在这里插入图片描述

如果打算使用分享的话,那么请尽快申请各大平台的appkey、appID等。这里我就不多细说了。

下面主要是如何用sharesdk进行配置

登录mob,选择sdk下载

网址:http://www.mob.com/download

(一):选择SDK下载、选择Android选项,选中新浪微博、微信、QQ,点击保存设置。

在这里插入图片描述

(二):然后选择右边的下载按钮,这时候会出现一个最新的基于Android Studio的gradle版本配置,只需要简单两步就可以集成进去。

在这里插入图片描述
(三):在根build下进行配置
在这里插入图片描述

(四):在项目的moudle下的build.gradle添加MobSDK的配置:

MobSDK {
     appKey "替换为mob官方申请的appkey"
    appSecret "替换为mob官方申请的appkey对应的appSecret"
    gui false    // 使用自定义的gui界面
    ShareSDK {
        //平台配置信息
        devInfo {
            SinaWeibo {   // 新浪微博
                appKey "23s050667"
                appSecret "a45019672f15f954esdfsef41d4411065"
                callbackUri "http://xxx.com/home/Index/indexx.html"
                shareByAppClient true    // 这里的true为从微博客户端进行启动,而不是从网页版的微博启动
            }
            Wechat {   // 微信好友分享
                appId "wx1f84cbafdsad7d477b"
                appSecret "f1839f6a28bb0f4xxxsa38150dd9a524"
            }
            WechatMoments {   // 微信朋友圈分享
                appId "wx1f84cbafdsad7d477b"
                appSecret "f1839f6a28bb0sdf0dd9a524"
            }
            QQ {    // QQ分享
                appId "110aafddsa024"
                appKey "269afdas1zTcvZ"
            }

            QZone {  // QQ空间分享
                appId "110aafddsa024"
                appKey "269afdas1zTcvZ"
            }

        }
    }

}

(五):以上的注释都很清楚,比如你只注册了个微信分享,而没有注册微信朋友圈分享的话,在代码中是导入不了微信朋友圈分享的包。
在这里插入图片描述
差不多就是上图这样子的。

(六):清单文件中进行配置:
AndroidManifest.xml:

	// 微信配置
        <activity
            android:name="wxapi.WXEntryActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:exported="true"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
	// QQ配置     
   <activity
            android:name="cn.sharesdk.tencent.qq.ReceiveActivity"
            android:launchMode="singleTask"
            android:noHistory="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="tencent+申请ID" />
            </intent-filter>
        </activity>

在这里插入图片描述

(七):WXEntryActivity.java:

public class WXEntryActivity extends WechatHandlerActivity {

    /**
     * 处理微信发出的向第三方应用请求app message
     * <p>
     * 在微信客户端中的聊天页面有“添加工具”,可以将本应用的图标添加到其中
     * 此后点击图标,下面的代码会被执行。Demo仅仅只是打开自己而已,但你可
     * 做点其他的事情,包括根本不打开任何页面
     */
    public void onGetMessageFromWXReq(WXMediaMessage msg) {
        if (msg != null) {
            Intent iLaunchMyself = getPackageManager().getLaunchIntentForPackage(getPackageName());
            startActivity(iLaunchMyself);
        }
    }

    /**
     * 处理微信向第三方应用发起的消息
     * <p>
     * 此处用来接收从微信发送过来的消息,比方说本demo在wechatpage里面分享
     * 应用时可以不分享应用文件,而分享一段应用的自定义信息。接受方的微信
     * 客户端会通过这个方法,将这个信息发送回接收方手机上的本demo中,当作
     * 回调。
     * <p>
     * 本Demo只是将信息展示出来,但你可做点其他的事情,而不仅仅只是Toast
     */
    public void onShowMessageFromWXReq(WXMediaMessage msg) {
        if (msg != null && msg.mediaObject != null
                && (msg.mediaObject instanceof WXAppExtendObject)) {
            WXAppExtendObject obj = (WXAppExtendObject) msg.mediaObject;
            Toast.makeText(this, obj.extInfo, Toast.LENGTH_SHORT).show();
        }
    }
}

(九):来一张效果图:

在这里插入图片描述
(十一):点击右上角,进行弹框,然后点击icon进行分享。(代码可能有些乱,欢迎指正)

(1):点击按钮进行弹框:


    private void showShareDialog(final String shareTitle, final String shareDesc, final String shareImg, final String shareUrl) {

        new ShareDialog(mContext, new ShareDialog.onClickback() {
            @Override
            public void onShare(int resId) {
                switch (resId) {
                    case Constants.SHARE_WECHAT:
                        ShareUtil.share(mContext, Constants.SHARE_WECHAT, shareTitle, shareDesc, shareImg, shareUrl);
                        break;
                    case Constants.SHARE_WECHAT_CIRCLE:
                        ShareUtil.share(mContext, Constants.SHARE_WECHAT_CIRCLE, shareTitle, shareDesc, shareImg, shareUrl);
                        break;
                    case Constants.SHARE_QQ:
                        ShareUtil.share(mContext, Constants.SHARE_QQ, shareTitle, shareDesc, shareImg, shareUrl);
                        break;
                    case Constants.SHARE_QQ_ZONE:
                        ShareUtil.share(mContext, Constants.SHARE_QQ_ZONE, shareTitle, shareDesc, shareImg, shareUrl);
                        break;
                    case Constants.SHARE_SINA_WEIBO:
                        ShareUtil.share(mContext, Constants.SHARE_SINA_WEIBO, shareTitle, shareDesc, shareImg, shareUrl);
                        break;
                }
            }
        }, Constants.SHARE_WECHAT, Constants.SHARE_WECHAT_CIRCLE, Constants.SHARE_QQ, Constants.SHARE_QQ_ZONE, Constants.SHARE_SINA_WEIBO).show();
    }

(2)ShareDialog弹框类:

public class ShareDialog extends Dialog {
    private onClickback callback;

    public ShareDialog(Context context, onClickback callback, int... args) {
        this(context, R.layout.dialog_share, R.style.DialogTheme, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
        this.callback = callback;
        for (int i = 0; i < args.length; i++) {
            int arg = args[i];
            switch (arg) {
                case Constants.SHARE_REPORT:
                    findViewById(R.id.ll_report).setVisibility(View.VISIBLE);
                    break;
                case Constants.SHARE_FEEDBACK:
                    findViewById(R.id.ll_feedback).setVisibility(View.VISIBLE);
                    break;
                case Constants.SHARE_DISSMISS_AUTHOR:
                    findViewById(R.id.ll_author).setVisibility(View.VISIBLE);
                    break;
                case Constants.SHARE_DISSMISS_ARTICLE:
                    findViewById(R.id.ll_article).setVisibility(View.VISIBLE);
                    break;
                case Constants.SHARE_WECHAT:
                    findViewById(R.id.ll_share_wechat).setVisibility(View.VISIBLE);
                    break;
                case Constants.SHARE_WECHAT_CIRCLE:
                    findViewById(R.id.ll_share_wechat_circle).setVisibility(View.VISIBLE);
                    break;
                case Constants.SHARE_SINA_WEIBO:
                    findViewById(R.id.ll_share_sina_weibo).setVisibility(View.VISIBLE);
                    break;
                case Constants.SHARE_URL:
                    findViewById(R.id.ll_share_url).setVisibility(View.VISIBLE);
                    break;
                case Constants.SHARE_QQ:
                    findViewById(R.id.ll_share_qq).setVisibility(View.VISIBLE);
                    break;
                case Constants.SHARE_QQ_ZONE:
                    findViewById(R.id.ll_share_qq_zone).setVisibility(View.VISIBLE);
                    break;
            }
        }
    }

    public ShareDialog(final Context context, int layout, int style, int width,
                       int height) {
        super(context, style);
        setContentView(layout);
        setCanceledOnTouchOutside(true);
        // 设置属性值
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.width = width;
        lp.height = height;
        getWindow().setAttributes(lp);
        setListener();
    }

    // 设置点击事件
    private void setListener() {
        findViewById(R.id.iv_feedback).setOnClickListener(new OnMultiClickListener() {
            @Override
            public void onMultiClick(View v) {
                callback.onShare(Constants.SHARE_FEEDBACK);
                dismiss();
            }
        });
        findViewById(R.id.tv_cancle).setOnClickListener(new OnMultiClickListener() {
            @Override
            public void onMultiClick(View v) {
                dismiss();
            }
        });
        findViewById(R.id.ll_report).setOnClickListener(
                new OnMultiClickListener() {

                    @Override
                    public void onMultiClick(View v) {
                        callback.onShare(Constants.SHARE_REPORT);
                        dismiss();
                    }
                });

        findViewById(R.id.ll_author).setOnClickListener(
                new OnMultiClickListener() {

                    @Override
                    public void onMultiClick(View v) {
                        callback.onShare(Constants.SHARE_DISSMISS_AUTHOR);
                        dismiss();
                    }
                });
        findViewById(R.id.ll_article).setOnClickListener(
                new android.view.View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        callback.onShare(Constants.SHARE_DISSMISS_ARTICLE);
                        dismiss();
                    }
                });
        findViewById(R.id.ll_share_wechat).setOnClickListener(
                new OnMultiClickListener() {

                    @Override
                    public void onMultiClick(View v) {
                        callback.onShare(Constants.SHARE_WECHAT);
                        dismiss();
                    }
                });
        findViewById(R.id.ll_share_wechat_circle).setOnClickListener(
                new OnMultiClickListener() {

                    @Override
                    public void onMultiClick(View v) {
                        callback.onShare(Constants.SHARE_WECHAT_CIRCLE);
                        dismiss();
                    }
                });
        findViewById(R.id.ll_share_url).setOnClickListener(
                new OnMultiClickListener() {

                    @Override
                    public void onMultiClick(View v) {
                        callback.onShare(Constants.SHARE_URL);
                        dismiss();
                    }
                });
        findViewById(R.id.ll_share_sina_weibo).setOnClickListener(new OnMultiClickListener() {
            @Override
            public void onMultiClick(View v) {
                callback.onShare(Constants.SHARE_SINA_WEIBO);
                dismiss();
            }
        });
        findViewById(R.id.ll_share_qq).setOnClickListener(new OnMultiClickListener() {
            @Override
            public void onMultiClick(View v) {
                callback.onShare(Constants.SHARE_QQ);
                dismiss();
            }
        });
        findViewById(R.id.ll_share_qq_zone).setOnClickListener(new OnMultiClickListener() {
            @Override
            public void onMultiClick(View v) {
                callback.onShare(Constants.SHARE_QQ_ZONE);
                dismiss();
            }
        });
    }

    @Override
    public void show() {
        super.show();
        //设置dialog显示动画
        getWindow().setWindowAnimations(R.style.main_menu_animStyle);
        // 设置显示位置为底部
        getWindow().setGravity(Gravity.BOTTOM);
    }

    public interface onClickback {
        void onShare(int resId);
    }
}

(3)ShareUtil的工具类:

public class ShareUtil {


    private static final String TAG = "ShareUtil";


    /**
     * @param context       上下文
     * @param shareType     朋友圈/微信/QQ
     * @param shareTitle
     * @param shareText
     * @param shareImageUrl
     * @param shareUrl
     */
    public static void share(Context context, int shareType, String shareTitle, String shareText, String shareImageUrl, String shareUrl) {
        Log.e(TAG, "share: " + shareTitle + "  shareDes  " + shareText + " shareImg  " + shareImageUrl + "   shareUrl " + shareUrl);
        MyShareListener listener = new MyShareListener();
        Platform.ShareParams sharePlatform = new Platform.ShareParams();
        Bitmap logo = BitmapFactory.decodeResource(context.getResources(), R.mipmap.icon_app);
        Platform platform;
        if (shareType == Constants.SHARE_WECHAT) {
            sharePlatform.setShareType(Platform.SHARE_WEBPAGE);
            setSharePlatform(sharePlatform, shareTitle, shareText, shareImageUrl, logo, shareUrl);
            if (shareUrl != null && !shareUrl.equalsIgnoreCase("")) {
                sharePlatform.setTitleUrl(shareUrl);
            }
            platform = ShareSDK.getPlatform(Wechat.NAME);
            if (!platform.isClientValid()) {
                GDApplication.getInstance().showToast("未安装微信");
                return;
            }
            platform.setPlatformActionListener(listener);
            platform.share(sharePlatform);
        } else if (shareType == Constants.SHARE_WECHAT_CIRCLE) {
            platform = ShareSDK.getPlatform(WechatMoments.NAME);
            if (!platform.isClientValid()) {
                GDApplication.getInstance().showToast("未安装微信");
                return;
            }
            sharePlatform.setShareType(Platform.SHARE_WEBPAGE);
            setSharePlatform(sharePlatform, shareTitle, null, shareImageUrl, logo,shareUrl);
            if (shareUrl != null && !shareUrl.equalsIgnoreCase("")) {
                sharePlatform.setTitleUrl(shareUrl);
            }
            platform.setPlatformActionListener(listener);
            platform.share(sharePlatform);
        }
        /**
         * 如果是QQ分享
         */
        else if (shareType == Constants.SHARE_QQ) {
            setSharePlatform(sharePlatform, shareTitle, shareText, shareImageUrl, logo,shareUrl);
            if (shareUrl != null && !shareUrl.equalsIgnoreCase("")) {
                sharePlatform.setTitleUrl(shareUrl);
            }
            sharePlatform.setShareType(Platform.SHARE_WEBPAGE);
            platform = ShareSDK.getPlatform(QQ.NAME);
            if (!platform.isClientValid()) {
                GDApplication.getInstance().showToast("未安装QQ");
                return;
            }
            platform.setPlatformActionListener(listener);
            platform.share(sharePlatform);
        } else if (shareType == Constants.SHARE_QQ_ZONE) {

            setSharePlatform(sharePlatform, shareTitle, shareText, shareImageUrl, logo,shareUrl);
            if (shareUrl != null && !shareUrl.equalsIgnoreCase("")) {
                sharePlatform.setTitleUrl(shareUrl);
            }
            sharePlatform.setShareType(Platform.SHARE_WEBPAGE);
            platform = ShareSDK.getPlatform(QZone.NAME);
            if (!platform.isClientValid()) {
                GDApplication.getInstance().showToast("未安装QQ");
                return;
            }
            platform.setPlatformActionListener(listener);
            platform.share(sharePlatform);
        } else if (shareType == Constants.SHARE_SINA_WEIBO) {

            setSharePlatform(sharePlatform, shareTitle, shareText, shareImageUrl, logo,shareUrl );
            if (shareUrl != null && !shareUrl.equalsIgnoreCase("")) {
                sharePlatform.setTitleUrl(shareUrl);
            }
            sharePlatform.setShareType(Platform.SHARE_WEBPAGE);
            platform = ShareSDK.getPlatform(SinaWeibo.NAME);
            if (!platform.isClientValid()) {
                GDApplication.getInstance().showToast("未安装微博");
                return;
            }
            platform.setPlatformActionListener(listener);
            platform.share(sharePlatform);
        }
    }

    private static void setSharePlatform(Platform.ShareParams sharePlatform, String shareTitle, String shareText, String shareImageUrl, Bitmap logo, String url) {
        sharePlatform.setShareType(Platform.SHARE_WEBPAGE);
        sharePlatform.setTitle(shareTitle);

        if (shareText != null && !shareText.equalsIgnoreCase("")) {
            sharePlatform.setText(shareText);
        }
        if (shareImageUrl != null && !shareImageUrl.equalsIgnoreCase("")) {
            sharePlatform.setImageUrl(shareImageUrl);
        } else {
            sharePlatform.setImageData(logo);
        }
        sharePlatform.setUrl(url);
    }


    static class MyShareListener implements PlatformActionListener {

        @Override
        public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
            Log.e(TAG, "onComplete: ");
        }

        @Override
        public void onError(Platform platform, int i, Throwable throwable) {
            Log.e(TAG, "onError: " + i + "   throwable   " + throwable.getMessage());
        }

        @Override
        public void onCancel(Platform platform, int i) {
            Log.e(TAG, "onCancel: ");
        }
    }
}

(4)从底部往上弹出的动画:

    <!-- dialog的动画 -->
    <style name="main_menu_animStyle">
        <!--windowEnterAnimation 进入的动画-->
        <!--代码里面-->
        <item name="android:windowEnterAnimation">@anim/dialog_in_anim</item>
        <item name="android:windowExitAnimation">@anim/dialog_out_anim</item>
    </style>

(5)dialog_in_anim.xml :

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="500"
        android:fromXDelta="0"
        android:fromYDelta="1000"
        android:toXDelta="0"
        android:toYDelta="0" />
</set>

(6)dialog_out_anim.xml :

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="500"
        android:fromXDelta="0"
        android:fromYDelta="0"
        android:toXDelta="0"
        android:toYDelta="1000" />
</set>

(7)最后是分享的面板布局 dialog_share.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/c_ffffff"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/dp_15"
        android:paddingTop="@dimen/dp_8"
        android:paddingBottom="@dimen/dp_8"
        android:text="请选择"
        android:textColor="@color/c_323232"
        android:textSize="@dimen/sp_14" />

    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/dp_10"
        android:scrollbars="none">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/dp_6"
            android:layout_marginRight="@dimen/dp_6"
            android:orientation="horizontal">

            <LinearLayout
                android:id="@+id/ll_share_wechat_circle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="@dimen/dp_8"
                android:visibility="gone">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@mipmap/ic_we_circle" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:paddingTop="@dimen/dp_10"
                    android:text="微信朋友圈" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ll_share_wechat"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="@dimen/dp_8"
                android:visibility="gone">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@mipmap/ic_wechat" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:paddingTop="@dimen/dp_10"
                    android:text="微信好友" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ll_share_sina_weibo"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="@dimen/dp_8"
                android:visibility="gone">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@mipmap/ic_weibo" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:paddingTop="@dimen/dp_10"
                    android:text="新浪微博" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ll_share_qq"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="@dimen/dp_8"
                android:visibility="gone">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@mipmap/ic_qq" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:paddingTop="@dimen/dp_10"
                    android:text="分享到QQ" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ll_share_qq_zone"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="@dimen/dp_8"
                android:visibility="gone">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@mipmap/ic_zone" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:paddingTop="@dimen/dp_10"
                    android:text="分享到QQ" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ll_share_url"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="@dimen/dp_8"
                android:visibility="gone">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@mipmap/ic_wechat" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:paddingTop="@dimen/dp_10"
                    android:text="复制链接" />
            </LinearLayout>
        </LinearLayout>
    </HorizontalScrollView>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="@dimen/dp_1"
        android:background="@color/c_divideline" />

    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="none">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/dp_6"
            android:layout_marginRight="@dimen/dp_6"
            android:orientation="horizontal">

            <LinearLayout
                android:id="@+id/ll_feedback"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="@dimen/dp_8"
                android:visibility="gone">

                <ImageView
                    android:id="@+id/iv_feedback"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@mipmap/ic_wechat" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingTop="@dimen/dp_10"
                    android:text="信箱反馈" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/ll_report"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="@dimen/dp_8"
                android:visibility="gone">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@mipmap/ic_wechat" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:paddingTop="@dimen/dp_10"
                    android:text="举报" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ll_article"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="@dimen/dp_8"
                android:visibility="gone">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@mipmap/ic_wechat" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:paddingTop="@dimen/dp_10"
                    android:text="屏蔽文章" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ll_author"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="@dimen/dp_8"
                android:visibility="gone">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@mipmap/ic_wechat" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:paddingTop="@dimen/dp_10"
                    android:text="屏蔽作者" />
            </LinearLayout>
        </LinearLayout>
    </HorizontalScrollView>


    <TextView
        android:layout_width="match_parent"
        android:layout_height="@dimen/dp_1"
        android:background="@color/c_f7f7f7" />

    <TextView
        android:id="@+id/tv_cancle"
        android:layout_width="match_parent"
        android:layout_height="@dimen/dp_40"
        android:gravity="center"
        android:text="取消"
        android:textColor="@color/c_666666"
        android:textSize="@dimen/sp_13" />
</LinearLayout>

就这样,一个简单的mob sharesdk自定义分享功能就做好了,注意一定要参数传入正确。

关注「蛇崽网盘教程资源」公众号 ,在微信后台回复「领取资源」,获取IT资源200G干货大全。

更多资源请访问:

超详细图文搭建个人免费博客

关注「蛇崽网盘教程资源」公众号 ,在微信后台回复「领取资源」,获取IT资源200G干货大全。

在微信后台回复「130个小程序」,即可免费领取享有导入就能跑的微信小程序

在这里插入图片描述

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android mob(sharesdk)微信分享/微信朋友圈分享/QQ分享/QQ空间分享/新浪微博分享(自定义) 的相关文章

随机推荐

  • 2023美赛C题-Wordle预测思路及matlab代码

    作者简介 热爱科研的Matlab仿真开发者 修心和技术同步精进 matlab项目合作可私信 个人主页 Matlab科研工作室 个人信条 格物致知 更多Matlab仿真内容点击 智能优化算法 神经网络预测 雷达通信
  • CSS中的弹性布局:flex

    1 flex布局 Flexible Box 1 1 任何一个容器都可以指定为flex布局 可以应用于 块级 元素 也可以用于行内元素 1 2 当父设置flex布局后 子元素的float clear vertical align属性将失效 2
  • 使用pnpm搭建workspace

    前言 上一节中我们使用vite lib打包了组件库 但发现对component调试时很不理想 而pnpm的workspace就是解决这种问题的 开始工作 在core view之上的根目录 建立pnpm workspace yaml 内容如下
  • STM32示波器设计

    目录 前言 1 硬件模块 2 示波器基础知识 2 1 当头一棒就是 波形的概念 2 2 第二就是需要观察的波形参数 2 3 第三就是示波器参数 2 3 1 采样率 2 3 2 带宽 2 3 4 刷新率 3 ADC采集和DAC输出 3 1 A
  • intel外设接口介绍(Intel Arria 10 Hard Processor System Technical Reference Manual)----SPI

    原文链接 https www intel com content www us en docs programmable 683711 21 2 features of the spi controller html 20 1 Featur
  • CSS 初始化 base.css 文件

    公共样式 body h1 h2 h3 h4 h5 h6 form fieldset div dl dt dd ul ol li input button textarea p th td a img strong margin 0px pa
  • antd Upload上传报Uncaught TypeError: items.map is not a function错误

    在写项目的时候 使用到了antd里面的Upload来上传文件 写好之后运行报错 代码是这样的 const uploadProps action createTheURL software stu score upload method PO
  • 如何查看服务器文件读写未释放流,传输管理_查看及释放请求(Requests)

    一套运维的ERP系统 通常由开发 测试 生产等多台服务器组成 测试 生产服务器常规情况是不能进行配置和程序维护 Transaction SCC4 详见 定义客户端 Client 变更是在开发服务器中完成 在开发服务器中 将配置数据和维护程序
  • 在vscode中使用xdebug调试PHP---绝对解决远程xdebug调试不了的问题

    在vscode中使用xdebug调试PHP 绝对解决远程xdebug调试不了的问题 1 vscode插件安装 2 检查并安装php的xdebug扩展 php m 3 修改远程主机上php ini中的xdebug的配置信息 vi php in
  • dubbo_远程同步调用原理

    Dubbo缺省协议采用单一长连接和NIO异步通讯 适合于小数据量大并发的服务调用 以及服务消费者机器数远大于服务提供者机器数的情况 Dubbo缺省协议 使用基于mina1 1 7 hessian3 2 1的tbremoting交互 连接个数
  • 使用 T5 模型来做文本分类任务的一些总结

    文章目录 T5 text2text 模型如何做 text classification 优化器和调度器 optimizer and scheduler 学习率设置 完整训练代码 Reference T5 paper Exploring th
  • Arduino使用TinyML实现水果识别

    在本文中 板载手势传感器将用于收集对象识别数据 这些数据将用于创建TensorFlow Lite模型 该模型可用于识别特定对象 电路板的接近传感器功能将用于识别物体何时靠近电路板 而RGB传感器用于首先收集物体的颜色数据 然后正确识别物体
  • ios开发 上传到App Store 时出错. iTunes Store Operation Failed, An Error occurred uploading to the iTunes ...

    ios开发 上传到App Store 时出错 iTunes Store Operation Failed An Error occurred uploading to the iTunes store 的解决方法 网上找了很多 如下 当然没
  • 玩转ESP8266-01——AT指令集

    该指令集是接上一个 链接 初识AT指令 全部是根据本人在使用esp8266过程中用过的指令 可能有不全 有错误 还请理解指正 一起学习 AT指令集 一 基础指令 1 测试指令 2 复位指令 重启 二 设置指令 1 设置波特率 2 设置工作模
  • 程序员如何做副业可以实现财富自由?

    这几年呢 我做包括自媒体在内的各种副业 也挣了一些钱 更有想象不到的一些收获 最近呢 也有一些朋友问我说晚风怎么样做一些副业 那今天呢 我就给大家分享五点 我认为做副业必须要考虑的问题 1 副业和主业尽量相关 那第一点呢 就是如果你决定做副
  • C++的指针与引用可能并不难,只是你没理解

    目录 复合类型 引用 引用即别名 引用的定义 引用的两种例外情况 指针 获取对象的地址 指针值 利用指针访问对象 某些符号有多重含义 空指针 建议 初始化所有指针 赋值和指针 其他指针操作 void 指针 理解复合类型的声明 定义多个变量
  • 统计学中的方差分析

    文章目录 1 0 方差分析 1 1方差分析概念 1 2 单因素方差分析 1 2 1 单因素方差分析 1 2 2 方差分析基本数语 1 2 3 造成误差的原因 1 3 方差分析的3个假定 1 4 方差分析的步骤 2 0 总结 1 0 方差分析
  • vue3项目打包后整合到springboot项目中运行

    概述 一般来说 前后端分离项目 比如vue3 springboot的前后端分离项目 一般把vue3项目打包后部署到nginx或者tomcat上面 springboot项目单独打包 那如果想把vue3项目打包后直接部署到springboot项
  • 对矩阵的处理 MATLAB

    矩阵 1 创建矩阵 1 直接输入法s 1 1 2 2 3 3 4 4 结果如图 2 利用某些函数zeros或ones创建 3 复数矩阵 直接按照直接输入法来建立矩阵 但是元素可以直接打成复数的形式 a bj 2 还有就是分别建立一个实部还有
  • Android mob(sharesdk)微信分享/微信朋友圈分享/QQ分享/QQ空间分享/新浪微博分享(自定义)

    使用场景 H5混合开发转Android 原生开发 之前也是用的友盟分享 微信原生 QQ原生 微博原生分享 今天这个项目恰好是用的mob的sharesdk分享 老实说 还是第一次使用 一开始接手项目的时候 还以为mob是个后台 来一张效果图