xposed开发6 - 微信首页添加按钮

xposed开发6 - 微信首页添加按钮

[原创]Xposed__给微信加个按钮

原文章如上, 过程看了没看懂, 直接跑代码看效果

// 微信首页添加按钮
hookClass = "com.tencent.mm.ui.LauncherUI";
hookMethodName = "onCreateOptionsMenu";
XposedHelpers.findAndHookMethod(hookClass, lpparam.classLoader, hookMethodName, Menu.class, new XC_MethodHook() {
    @Override
    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
        super.beforeHookedMethod(param);
        Menu menu = (Menu) param.args[0];
        menu.add(0, 3, 0, "我是新加的按钮");
        for (int i = 0; i < menu.size(); i++) {
            final int finalI = i;
            menu.getItem(i).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    XposedBridge.log("点击了: " + finalI + "");
                    return false;
                }
            });
        }
    }
});

xposed开发6 - 微信首页添加按钮_第1张图片

xposed开发6 - 微信首页添加按钮_第2张图片

你可能感兴趣的:(xposed开发)