启用硬件加速的Andr​​oid应用程序,针对蜂窝以前的版本 [英] Enable hardware acceleration in Android app, targeting Honeycomb AND prior versions

查看:130
本文介绍了启用硬件加速的Andr​​oid应用程序,针对蜂窝以前的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要启用硬件加速在Android 3.0+应用程序,我可以做到这一点:

To enable hardware acceleration in an Android 3.0+ app I can do this:

<application android:hardwareAccelerated="true" ... />

但应用程序将不会与该属性present建设,如果我指定的操作系统版本pre-11。有没有一种方法来启用硬件加速的应用程序,都作为目标蜂窝前,还是硬件加速仅适用于那些创建应用程序,只适用于3.0 +?

But the app won't build with that attribute present if I target an OS version pre-11. Is there a way to enable hardware acceleration in an app that targets both Honeycomb and prior, or is hardware acceleration only available for those creating apps that only work on 3.0+?

我看看对活动的方法,但我没有看到一个。

I had a look for a method on Activity but I don't see one.

推荐答案

尝试设置生成目标为3.0版本,但设置的minSdkVersion 你想要的最古老的版本支持。它至少应该允许您建立,但不会对旧版本启用硬件加速。

Try to set build target to the 3.0 version, but set minsdkversion to the oldest version you want to support. It should at least allow you to build, but will not enable HW-acceleration on the older versions.

在<一个href="http://developer.android.com/guide/topics/manifest/application-element.html#hwaccel">documentation:

这是Android的3.0开始,硬件加速的OpenGL渲染是提供给应用程序,以改善许多常见的2D图形操作的性能。当硬件加速渲染器被启用,在画布,颜料,Xfermode,ColorFilter,着色器和摄像机大多数操作的速度。这将导致更加平滑的动画,流畅的滚动,和整体提高响应速度,即使应用程序不明确的使用框架的OpenGL库。

Starting from Android 3.0, a hardware-accelerated OpenGL renderer is available to applications, to improve performance for many common 2D graphics operations. When the hardware-accelerated renderer is enabled, most operations in Canvas, Paint, Xfermode, ColorFilter, Shader, and Camera are accelerated. This results in smoother animations, smoother scrolling, and improved responsiveness overall, even for applications that do not explicitly make use the framework's OpenGL libraries.

没有测试过3.0的API还没有自己,但文档似乎是说这应该是支持...

Have not tested the 3.0 API yet myself, but the documentation seems to say this should be supported...

<manifest ... >
    <uses-sdk android:minSdkVersion="4" 
          android:targetSdkVersion="11" />
    <application ... >
    ...
    <application>
</manifest>

(从切优化的应用程序为Android 3.0

这篇关于启用硬件加速的Andr​​oid应用程序,针对蜂窝以前的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆