1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 第三方APK如何隐藏虚拟按键

第三方APK如何隐藏虚拟按键

时间:2019-12-03 22:25:39

相关推荐

第三方APK如何隐藏虚拟按键

全面屏时代,android设备已经很少有键盘的存在了,为了便捷,虚拟按键应运而生,当然iphone的手势控制也有一部分厂商移植到了android系统中。

本文主要是关于底部的三个虚拟按键RECENT、HOME、BACK对于第三方APK如何隐藏。

View.java的API显示,三个虚拟按键都是hide,即只有系统APK可以调用:

/*** @hide** NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked* out of the public fields to keep the undefined bits out of the developer's way.** Flag to hide only the recent apps button. Don't use this* unless you're a special part of the system UI (i.e., setup wizard, keyguard).*/public static final int STATUS_BAR_DISABLE_RECENT = 0x01000000;/*** @hide** NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked* out of the public fields to keep the undefined bits out of the developer's way.** Flag to hide only the home button. Don't use this* unless you're a special part of the system UI (i.e., setup wizard, keyguard).*/public static final int STATUS_BAR_DISABLE_HOME = 0x00200000;/*** @hide** NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked* out of the public fields to keep the undefined bits out of the developer's way.** Flag to hide only the back button. Don't use this* unless you're a special part of the system UI (i.e., setup wizard, keyguard).*/public static final int STATUS_BAR_DISABLE_BACK = 0x00400000;

那第三方APK如何控制呢?

// 定义与API中相同的数值private static final int STATUS_BAR_DISABLE_RECENT = 0x01000000;private static final int STATUS_BAR_DISABLE_HOME = 0x00200000;private static final int STATUS_BAR_DISABLE_BACK = 0x00400000;@Overrideprotected void onCreate(Bundle icicle) {super.onCreate(icicle);...int flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;KeyguardManager mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);flags |= STATUS_BAR_DISABLE_RECENT;Log.i(TAG, "disable recent!");getWindow().getDecorView().setSystemUiVisibility(flags);...}

示例显示了如何隐藏RECENT虚拟按键。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。