Android帧率修改

1.app设置帧率

  • 影响范围:仅影响当前App,退出App后帧率恢复正常
  • 参考代码
java 复制代码
// 读取系统支持的Display mode
Display defaultDisplay = getWindowManager().getDefaultDisplay();
Display.Mode[] supportedModes supportedModes = defaultDisplay.getSupportedModes();

WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
// 设置mode 0的帧率
layoutParams.preferredDisplayModeId = supportedModes[0].getModeId();
getWindow().setAttributes(layoutParams);

2.命令行的方式

java 复制代码
// 末尾数字0是modeId,也可以替换为1,2;不同的数字对应屏幕的能支持的不同帧率档位
adb shell service call SurfaceFlinger 1035 i32 0
相关推荐
纟 冬18 分钟前
Flutter & OpenHarmony 运动App运动提醒组件开发
android·java·flutter
QING61820 分钟前
Kotlin Flow 中 flatMap 与 flatMapLatest 的核心差异 —— 新手指南
android·kotlin·android jetpack
行稳方能走远33 分钟前
Android C++ 学习笔记 2
android·c++
2501_946233891 小时前
Flutter与OpenHarmony我的作品页面实现
android·javascript·flutter
鹏多多1 小时前
Flutter下拉刷新上拉加载侧拉刷新插件:easy_refresh全面使用指南
android·前端·ios
studyForMokey2 小时前
【Android Gradle】Gradle系列
android
HeDongDong-2 小时前
Kotlin Lambda 表达式详解
android·开发语言·kotlin
行稳方能走远4 小时前
Android C++ 学习笔记3
android·c++
7ioik9 小时前
Explain关键字?
android