2016-04-27 70 views
0

我有一個imageView,從中我用getDrawingCache()拍攝可見的圖像部分。它運作良好。但是,當我在imageView中更改圖像並嘗試從中獲取位圖時,getDrawingCache()返回第一個圖像的位圖。在致電getDrawingCache()之前,我試圖調用這個方法buildDrawingCache(),但它沒有幫助。在ImageView中刷新圖像緩存

如何刷新緩存或關聯的位圖或者我不知道爲了獲得新圖像?

回答

1

解決方案很簡單:

imageView.destroyDrawingCache(); 
    imageView.buildDrawingCache(); 
    imageView.getDrawingCache();