-
参考链接:
-
准备一个关机的图标,网上去找
-
将这个图标放入 Android 源码目录,如下
frameworks/base/packages/SystemUI/res/drawable-nodpi/ic_sysbar_power.png
在下面的文件里面增加相关的字符:
frameworks/base/packages/SystemUI/res/values/strings.xml 倒数第二行添加: <string name="accessibility_power" translatable="false">Power</string>
添加按键布局:
frameworks/base/packages/SystemUI/res/layout/power.xml<com.android.systemui.statusbar.policy.KeyButtonView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res-auto" android:id="@+id/power" android:layout_width="@dimen/navigation_key_width" android:layout_height="match_parent" android:layout_weight="0" android:src="@drawable/ic_sysbar_power" systemui:keyCode="0" android:scaleType="center" android:contentDescription="@string/accessibility_power" android:paddingStart="@dimen/navigation_key_padding" android:paddingEnd="@dimen/navigation_key_padding" />