Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

So i recently switched to android 3.0 (honeycomb) and i'm having some issues with hardware rendering, specifically at a certain custom view i've written where I use a font size of 200 to display some text.

Unfortunately it seems the openGLRenderer doesn't like that kind of rather large font sizes very much, given the error i'm getting in the log:

06-06 16:22:00.080: ERROR/OpenGLRenderer(2503): Font size to large to fit in cache. width, height = 97, 145

Are there ways around this (or ways to fix it) such that I can get the text displayed at the wanted font size?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
311 views
Welcome To Ask or Share your Answers For Others

1 Answer

It is really a bug in the Android OS inside the Hardware Acceleration modules. I think that the best way is to ask the system to avoid HW acceleration on TextViews that contain large size text. To do so, just add in the code:

TextView bigText = (TextView) findViewById(R.id.bigtext);
bigText.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...