ViewCache的理解

 View组件显示的内容可以通过cache机制保存为bitmap, 使用到的api有

    void  setDrawingCacheEnabled(boolean flag),

    Bitmap  getDrawingCache(boolean autoScale),

    void  buildDrawingCache(boolean autoScale),

    void  destroyDrawingCache()

    我们要获取它的cache先要通过setDrawingCacheEnable方法把cache开启,然后再调用getDrawingCache方法就可以获得view的cache图片了。buildDrawingCache方法可以不用调用,因为调用getDrawingCache方法时,若果cache没有建立,系统会自动调用buildDrawingCache方法生成cache。若果要更新cache, 必须要调用destoryDrawingCache方法把旧的cache销毁,才能建立新的。

当调用setDrawingCacheEnabled方法设置为false, 系统也会自动把原来的cache销毁。

   ViewGroup在绘制子view时,而外提供了两个方法

   void setChildrenDrawingCacheEnabled(boolean enabled)

   setChildrenDrawnWithCacheEnabled(boolean enabled)

   setChildrenDrawingCacheEnabled方法可以使viewgroup里所有的子view开启cache, setChildrenDrawnWithCacheEnabled使在绘制子view时,若该子view开启了cache, 则使用它的cache进行绘制,从而节省绘制时间。

   获取cache通常会占用一定的内存,所以通常不需要的时候有必要对其进行清理,通过destroyDrawingCache或setDrawingCacheEnabled(false)实现。

PS E:\study\ABAP开发\fiori学习\SAP FIORI> cd .\project1\ PS E:\study\ABAP开发\fiori学习\SAP FIORI\project1> npm start > project1@0.0.1 start > fiori run --open "test/flpSandbox.html?sap-ui-xx-viewCache=false#project1-display" (node:19836) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userl and alternative instead. (Use `node --trace-deprecation ...` to show where the warning was created) info fiori-tools-proxy Using UI5 version 1.128.1 based on manifest.json info fiori-tools-proxy Starting fiori-tools-proxy using following configuration: info fiori-tools-proxy proxy: 'undefined' info fiori-tools-proxy ignoreCertError: 'false' info fiori-tools-proxy backend: [{"path":"/sap","url":"http://www.saps4hana.cn:50000"}] info fiori-tools-proxy ui5: [{"path":"/resources","url":"https://ui5.sap.com","version":"1.128.1"} ,{"path":"/test-resources","url":"https://ui5.sap.com","version":"1.128.1"}] info fiori-tools-proxy debug: 'false' info backend-proxy-middleware Using KeyStoreManager for secure storage. warn backend-proxy-middleware No credential found. Service: [fiori/v2/system], Key: [http://www.sa ps4hana.cn:50000] info backend-proxy-middleware Using KeyStoreManager for secure storage. warn backend-proxy-middleware No credential found. Service: [fiori/v2/system], Key: [http://www.sa ps4hana.cn:50000] info backend-proxy-middleware Backend proxy created for http://www.saps4hana.cn:50000 /sap info fiori-tools-appreload Livereload middleware started for port 35729 and path E:\study\ABAP开发 \fiori学习\SAP FIORI\project1\webapp warn fiori-tools-preview The configuration option 'rta' is deprecated. Please use 'editors.rta' in stead. info fiori-tools-preview Initialized for app project1 Server started URL: http://localhost:8080 info fiori-tools-preview HTML file returned at /test/flpSandbox.html is loaded from the file system (node:9672) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.a (Use `node --trace-deprec
03-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值