Open hurshi opened 6 years ago
He has said that this view is worked by setShadowLayer( ). So,it must close the GPU by setLayerType(LAYER_TYPE_SOFTWARE, null). If your view is very big or your view tree is very deep,the CPU will be wasted. And the page will be not smooth or something unexpected will be happened...
First, can add android:hardwareAccelerated="false" in AndroidManifest. But the performance is not very good. Yes!This causes waste of CPU. I have saw in the Android Profiler. Get the conclusion from the diff between CardView and the ShadowView. You can see the method buildDrawingCacheImpl in View. In that method will create one bitmap to set the cache. The CPU and memory will be larger than the CardView.
Note
this problem repeat in your demo project,only change the 'activity_shadow_view.xml'
Code: change 'activity_shadow_view.xml' like this:
com.loopeer.example.shadows W/View: ShadowView not displayed because it is too large to fit into a software layer (or drawing cache), needs 37307904 bytes, only 14745600 available