发现viewpage xml里面有一个属性
android:persistentDrawingCache=
表示缓存动画,这样不会一次次的加载了
http://developer.android.com/reference/android/view/ViewGroup.html
android:persistentDrawingCache
Defines the persistence of the drawing cache. The drawing cache might be enabled by a ViewGroup for all its children in specific situations (for instance during a scrolling.) This property lets you
persist the cache in memory after its initial usage. Persisting the cache consumes more memory but may prevent frequent garbage collection is the cache is created over and over again. By default the persistence is set to scrolling.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
none |
0x0 | The drawing cache is not persisted after use. |
animation |
0x1 | The drawing cache is persisted after a layout animation. |
scrolling |
0x2 | The drawing cache is persisted after a scroll. |
all |
0x3 | The drawing cache is always persisted. |
This corresponds to the global attribute resource symbol persistentDrawingCache
.