Android上的帆布字包梁TEX [英] word wraped tex on Android canvas

查看:133
本文介绍了Android上的帆布字包梁TEX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一些字符串写入到画布(动态壁纸),但是长的字符串没有得到词包梁有没有办法做到这一点?结果
我认为,画布,我可以使用这个唯一的东西,因为它是一个动态壁纸。

I'm trying to write some strings to a canvas (live wallpaper) however long string don't get word-wraped is there any way to do it?
I think canvas is the only thing I can use for this, since it's a live wallpaper.

推荐答案

没有必要做自己的自动换行。

No need to do your own word wrapping.

查看android.text.Layout和其子android.text.StaticLayout和android.text.DynamicLayout

Check out android.text.Layout and its subclasses android.text.StaticLayout and android.text.DynamicLayout

是这样的:

StaticLayout layout = new StaticLayout(text, txtpaint, textW,Layout.Alignment.ALIGN_NORMAL, 1.3f, 0, false);
txtcanvas.translate(xoffs, yoffs); //position the text
layout.draw(txtcanvas);

这篇关于Android上的帆布字包梁TEX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆