Turn on hardware acceleration if available (such Android 3+) with Android APK 2.2

随声附和 提交于 2019-12-02 21:51:15

Add android:hardwareAccelerated="true" to your manifest, either for the <activity> or the <application>.

This attribute will be ignored on older versions of Android, but will be honored on Android 3.0+.

This will require you to have set your build target to API Level 11 or higher, but you probably already have that.

If you need support devises with old OS (2.3.X and older) version, not add android:hardwareAccelerated="true" to your manifest, try add this code in your java:

try { if( Build.VERSION.SDK_INT >= 11) getWindow().setFlags( 16777216, 16777216); } catch( Exception e) {} // FLAG_HARDWARE_ACCELERATED == 16777216 (0x01000000)

This is work in OS 3.0++ and not call error on 2.3.X and older.

You can look here to see how you can enable features based on Android version. You can do it with reflection too, but it is clunky.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!