9

i have a TextView inside of a ReleativeLayout which i set a big Text into that at runtime. the problem is about my ReleativeLayout background which is a rounded shape with a border. it doesn't set the background and in Logcat it says that :

12-12 16:26:56.602: W/OpenGLRenderer(7400): Path too large to be rendered into a texture

i've solved this issue by turning android:hardwareAccelerated to false in manifest file(one activity not whole application) , but it raise another error when i use sliding menu inside my Activity which it tells that :

12-12 16:37:05.717: E/AndroidRuntime(9520): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@4633e3f8 

i have just a ListView without any bitmap inside of my SlidingMenu which is 6Wunderkinder SlidingLayer library.

any help would be appreciated.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Arash GM
  • 10,316
  • 6
  • 58
  • 76

3 Answers3

18

Finally solved it with just changing LayerType of my Fragment ScrollView from HardwareAcceleration to Software without setting HardwareAcceleration false for whole Activity which caused strange bahavior as mentioned on SlidingMenu :

<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layerType="software">
Arash GM
  • 10,316
  • 6
  • 58
  • 76
  • This is not exactly solving the problem. Answer is not taking into account possible performance consequences. – Dmitry Zaytsev Jul 29 '15 at 10:20
  • If anything, I saw improved performance with a software layerType -- presumably disabling hardware texture rendering had no adverse effects on the half-dozen low- and high-end devices I tested. – cetcet Nov 18 '15 at 23:05
  • Been stuck converting our 2009 app to the Target 26. All graphics went slug. Fixed it in a pinch! – halxinate Sep 03 '18 at 02:24
5

This happens to me when i have a scrollview that is too long with a drawable in the rootview, this effects every device uniquely. My Nexus 9 will show most anything but my sony compact won't. It is not worth it to turn hardware acceleration off because on low end devices you will probably have a very choppy application.

In this situation you should probably consider using a listview or recyclerview instead to ensure your background element is not larger than the screen. Even XML drawables in the background of a not so long scrollview will create this error. I choose for safety and would redesign elements, simplu removing the background from the scrollview could be an options , and placing them as tiles in the inner elements.

It is seems strange but it must have to do with how the background is rendered by that rootview in a longer scrollview, because a scrollview itself can be quite long, with many complex elements without an issues, and background colors are as well never a problem..

brian
  • 51
  • 1
  • 1
3

If you want to do it programmatically you can set:

view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Chase Roberts
  • 9,082
  • 13
  • 73
  • 131