文字在正确的地方开始.
int question_text_wIDth = game_question_bg.getWIDth();int question_text_xPos = 100;int question_text_yPos = 100;StaticLayout question_text = new StaticLayout(text,text_paint,question_text_wIDth,Layout.Alignment.AliGN_CENTER,1.2f,1.0f,false);//position Textcanvas.translate(question_text_xPos,question_text_yPos);//As a form of setMaxlinecanvas.clipRect(new Rect(0,game_question_bg.getWIDth(),game_question_bg.getHeight()));question_text.draw(canvas);//reset canvas back to normalcanvas.restore();解决方法 创建StaticLayout时,可以使用您作为参数传递的TextPaint设置字体大小:
TextPaint text_paint = new TextPaint();float FontSize = 25;text_paint.setTextSize(FontSize);StaticLayout question_text = new StaticLayout(text,false);总结
以上是内存溢出为你收集整理的Android Staticlayout字体大小全部内容,希望文章能够帮你解决Android Staticlayout字体大小所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)