Hardware Acceleration

硬件加速学习:

参考:http://blog.csdn.net/thinkinwm/article/details/8854649

硬件加速的级别:

Application:

可以打开和关闭硬件加速

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

Activity:

可以打开和关闭硬件加速

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

Window:

只能打开,不能关闭

1 getWindow().setFlags(
2     WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
3     WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);

View:

只能关闭,不能打开

myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

判断是否打开了硬件加速:

If you must do this check in your drawing code, use Canvas.isHardwareAccelerated() instead ofView.isHardwareAccelerated() when possible. When a view is attached to a hardware accelerated window, it can still be drawn using a non-hardware accelerated Canvas. This happens, for instance, when drawing a view into a bitmap for caching purposes.

posted @ 2014-09-02 15:15  自由飞翔2012  阅读(236)  评论(0)    收藏  举报