自己的andorid app中设置了
在MainActivity.onCreate中,设置也开启了window的硬件加速:
setContentView(R.layout.main);
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
但是UI中的控件得到的硬件加速的状态为ac为false:
FrameLayout globalFramelayout = (FrameLayout)findViewById(R.id.my_framelayout);
boolean ac = globalFramelayout.isHardwareAccelerated();
请问:
1. 这样判定ac加速的方式正确吗?
2. 如果正确,为什么没有开启硬件加速功能?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
android:hardwareAccelerated="true"
有这一条 一般已经开启了
你是对的,用
android:hardwareAccelerated="true"就能开去硬件加速。硬加速可以在Application、Activity级别上开启,View级别上只能关闭该View的加速,Application或Activity上开启之后View上也就默认开启了。之所以你没能得到ac为true,可能是你的设备本身不支持硬加速,模拟器和真机都会有不支持的情况。