How does Android's setDrawingCacheEnabled() work?

前端 未结 2 977
盖世英雄少女心
盖世英雄少女心 2021-02-02 10:35

I have a UI where the root layout is a RelativeLayout. It has a number of Views, such as fields, buttons, etc.

There are also two other panels that are initially invisib

2条回答
  •  佛祖请我去吃肉
    2021-02-02 11:04

    From Android documentation (http://developer.android.com/reference/android/view/View.html#setDrawingCacheEnabled%28boolean%29):

    Enabling the drawing cache is similar to setting a layer when hardware acceleration is turned off. When hardware acceleration is turned on, enabling the drawing cache has no effect on rendering because the system uses a different mechanism for acceleration which ignores the flag. If you want to use a Bitmap for the view, even when hardware acceleration is enabled, see setLayerType(int, android.graphics.Paint) for information on how to enable software and hardware layers.

    Maybe this is your case?

提交回复
热议问题