反编译SystemUI.apk
1.这是下拉任务栏显示一键锁屏
SystemUI\res\layout\tw_status_bar_expanded_header.xml
搜索
<Space android:layout_width="0.0dip" android:layout_height="0.0dip" android:layout_weight="1.0" />
下面起一行添加
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/home" android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lock" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_recent" android:contentDescription="@string/accessibility_home" systemui:keyCode="3" systemui:keyRepeat="true" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
添加后显示会把设置那个按钮逼到屏幕外只看到一半左右顾要下一步
搜索
<RelativeLayout android:id="@id/settings_button" android:background="@drawable/tw_quick_panel_setting_button_bg" android:focusable="true" android:visibility="visible" android:layout_width="72.0dip" android:layout_height="39.0dip">
<ImageView android:id="@id/settings_button_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_quickpanel_icon_settings" android:scaleType="center" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:contentDescription="@string/accessibility_settings_button" />
改为
<RelativeLayout android:id="@id/settings_button" android:background="@drawable/tw_quick_panel_setting_button_bg" android:focusable="true" android:visibility="visible" android:layout_width="55.0dip" android:layout_height="39.0dip">
<ImageView android:id="@id/settings_button_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_quickpanel_icon_settings" android:scaleType="center" android:adjustViewBounds="true" android:maxWidth="48.0dip" android:maxHeight="48.0dip" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:contentDescription="@string/accessibility_settings_button" />
2.点击状态栏时间锁屏待机功能更
SystemUI\res\layout\tw_status_bar.xml
搜索
<LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:paddingLeft="6.0dip" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent">
在这一行的上面添加
<com.android.systemui.statusbar.policy.KeyButtonView android:layout_gravity="right" android:orientation="vertical" android:id="@id/back" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lockd" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
最后往drawable-xhdpi文件夹添加资源图片
状态栏锁屏要调用的
ic_sysbar_lockd.png
下拉任务栏要调用的
ic_sysbar_lock.png
1.这是下拉任务栏显示一键锁屏
SystemUI\res\layout\tw_status_bar_expanded_header.xml
搜索
<Space android:layout_width="0.0dip" android:layout_height="0.0dip" android:layout_weight="1.0" />
下面起一行添加
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/home" android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lock" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_recent" android:contentDescription="@string/accessibility_home" systemui:keyCode="3" systemui:keyRepeat="true" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
添加后显示会把设置那个按钮逼到屏幕外只看到一半左右顾要下一步
搜索
<RelativeLayout android:id="@id/settings_button" android:background="@drawable/tw_quick_panel_setting_button_bg" android:focusable="true" android:visibility="visible" android:layout_width="72.0dip" android:layout_height="39.0dip">
<ImageView android:id="@id/settings_button_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_quickpanel_icon_settings" android:scaleType="center" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:contentDescription="@string/accessibility_settings_button" />
改为
<RelativeLayout android:id="@id/settings_button" android:background="@drawable/tw_quick_panel_setting_button_bg" android:focusable="true" android:visibility="visible" android:layout_width="55.0dip" android:layout_height="39.0dip">
<ImageView android:id="@id/settings_button_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_quickpanel_icon_settings" android:scaleType="center" android:adjustViewBounds="true" android:maxWidth="48.0dip" android:maxHeight="48.0dip" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:contentDescription="@string/accessibility_settings_button" />
2.点击状态栏时间锁屏待机功能更
SystemUI\res\layout\tw_status_bar.xml
搜索
<LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:paddingLeft="6.0dip" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent">
在这一行的上面添加
<com.android.systemui.statusbar.policy.KeyButtonView android:layout_gravity="right" android:orientation="vertical" android:id="@id/back" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lockd" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
最后往drawable-xhdpi文件夹添加资源图片
状态栏锁屏要调用的
ic_sysbar_lockd.png
下拉任务栏要调用的
ic_sysbar_lock.png