在Java中的文本对齐库 [英] Text justification library in Java
问题描述
可能重复:
我可以设置TextView的财产喜欢自圆其说?
我正在写一个Android应用程序,需要文本对齐,不支持原生的,我不认为使用的WebView会因为字体和文本大小相对于工作的屏幕分辨率和尺寸。考虑到这一点,我会写延伸,这将做文本对齐,想知道是否有人知道的任何code我可以看看哪些已经做了这个救我一些时间TextView的自定义视图。任何其他有用的建议是pciated太大AP $ P $。
I'm writing an android app which needs text justification, which isn't supported natively, and I don't think using a WebView is going to work because of font and text sizes in relation to screen resolution and dimensions. With this in mind I'm going to write a custom view which extends the TextView which will do text justification and was wondering if anybody knows of any code I can look at which does this already to save me some time. Any other helpful advice would be greatly appreciated too.
推荐答案
我们已经为此创建了一个简单的类。目前有两种方法来实现你所期待的。这都需要否的WebView 和支持SPANNABLES
UPDATED
We have created a simple class for this. There are currently two methods to achieve what you are looking for. Both require NO WEBVIEW and SUPPORTS SPANNABLES.
库: https://github.com/bluejamesbond/TextJustify-Android
支持:安卓2.X到5.X
SUPPORTS: Android 2.X to 5.X
设置
// Please visit Github for latest setup instructions.
SCREENSHOT
这篇关于在Java中的文本对齐库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!