Android Staticlayout字体大小

Android Staticlayout字体大小,第1张

概述有没有改变静态布局的字体大小?这是我迄今为止所显示的 文字在正确的地方开始. int question_text_width = game_question_bg.getWidth();int question_text_xPos = 100;int question_text_yPos = 100;StaticLayout question_text = new StaticLayout 有没有改变静态布局的字体大小?这是我迄今为止所显示的
文字在正确的地方开始.
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字体大小所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1132106.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存