原始环境

  • 已经取得 root 权限的 Android 设备
  • 已安装对应设备驱动的 Windows
  • Java 运行环境
  • apktool.jar、adb.exe,以及支持无 BOM UTF-8 的文本编辑器

操作步骤

  • 从设备中拉取 /system/app/SystemUI.apk。
  • 使用 apktool 解包 APK 资源。
  • 打开 res/layout/system_bar.xml,找到音量键对应的 KeyButtonView。
  • 将需要隐藏的按键 android:layout_width 改为 0.0dp。
  • 先构建一次,再将 META-INF 和 AndroidManifest.xml 放回 build/apk 目录后重新构建。
  • 以可写方式重新挂载 /system,推送新的 SystemUI.apk,然后重启设备。
adb pull /system/app/SystemUI.apk .
apktool d -b -s SystemUI.apk

# after editing
apktool b SystemUI

adb shell
busybox mount -o remount,rw /system
exit
adb push SystemUI\dist\SystemUI.apk /system/app/SystemUI.apk
adb reboot