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
相关推荐
summerkissyou19874 小时前
Android - 摄像头 - hal - 开发教程,例子,常见问题,分析方法,解决方案
android
summerkissyou19875 小时前
Android 16 架构图
android
神龙天舞20015 小时前
MySQL 备库为什么会延迟好几个小时
android·数据库·mysql
海天鹰6 小时前
Android Studio Quail3 | 2026.1.3 升级后 Gradle 报错
android studio
码农coding9 小时前
android12 systemUI 之锁屏
android
圆山猫9 小时前
[Virtualization](三):RISC-V H-extension 与 Guest 执行模式
android·java·risc-v
爱笑鱼9 小时前
Binder(七):getCallingUid() 读到的是谁?clearCallingIdentity() 又清掉了什么?
android
2501_9159090615 小时前
iOS 应用反调试技详解术 检测调试器的原理与防护实践
android·ios·小程序·https·uni-app·iphone·webview
Lvan的前端笔记15 小时前
AndroidX 完全入门指南
android·androidx
帅次16 小时前
Android 应用高级面试:Window 近1年高频追问 18 题
android·面试·职场和发展