转自网络,不知道对你有没有帮助
[Java] 纯文本查看 复制代码 如题,可以hook状态栏,为系统状态栏添加一个TextView
@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.android.systemui"))
return;
resparam.res.hookLayout("com.android.systemui", "layout", "status_bar", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
FrameLayout simpBar = (FrameLayout) liparam.view;
if (simpBar != null) {
// FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) SimpBar.getLayoutParams();
// lp.height = 0;
// SimpBar.requestLayout();
TextView textView = new TextView(simpBar.getContext());
textView.setText("双时区+");
simpBar.addView(textView);
}
}
});
} |