android - app如何获取导航栏的模式
问题描述
意思是,应用程序如何在以下3种模式中获得导航栏模式
手势导航
三键导航
2键导航
解决方案
您可以使用以下代码,可能不适用于所有 android 设备
public static int isEdgeToEdgeEnabled(Context context) {
Resources resources = context.getResources();
int resourceId = resources.getIdentifier("config_navBarInteractionMode", "integer", "android");
if (resourceId > 0) {
return resources.getInteger(resourceId);
}
return 0;
}
isEdgeToEdgeEnabled 函数返回的值如下:
导航显示有 3 个按钮
使用 2 个按钮显示导航(Android P 导航模式)
全屏手势(Android Q上的手势)
推荐阅读
- java - 未经许可可以使用 TelephonyManager READ_PHONE_STATE
- android - 是否可以包装 ReactJs webApps 以构建跨平台移动应用程序?
- r - R tidyverse:从字符转换为数字时的数据集结构格式和错误
- postgresql - 如何在调用它之前检查是否存在 postgresql 过程
- swift - 定义类 Swift 时如何使用下划线
- go - 我收到一个错误致命错误:运行时:使用“go-ipfs-api”下载视频时内存不足
- r - 如何在 R 中编码,以便我的时间戳字段由色标表示,而个人数量由分级符号表示?
- javascript - 页面加载时,@Url.Action 在 javascript 中为 null 或 ""
- python - “TypeError:'pygame.Surface'对象不可迭代”尝试创建包时
- python - 如何从 Python 链接下载扩展名为 .torrent 的文件