我正在参考TextJustify-Android https://github.com/bluejamesbond/TextJustify-Android。我正在实施option 2在上面的链接中。当我在模拟器上运行我的应用程序时,文本会在一行中出现一个单词,在下一行中出现下一个单词,依此类推。我不知道我的代码有什么问题。请帮我。谢谢。
活动类代码-
textView1 = (TextView) findViewById (R.id.textView1);
textView1.setMovementMethod(new ScrollingMovementMethod());
textView1.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener()
{
boolean isJustified = false;
@Override
public boolean onPreDraw()
{
if(!isJustified)
{
TextJustifyUtils.run(textView1,0);
isJustified = true;
}
return true;
}
});
Xml代码-
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="8"
android:gravity="center">
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"
android:text="@string/his"
android:textColor="#FFFFFF"/>
</LinearLayout>
我正在实施TextJustifyUtils
按照上面链接中的建议在我的应用程序中进行课程。
我在给出的链接中做了一项更改TextJustifyUtils.run(textView1);
在我的代码中,Eclipse 建议我进行更改TextJustifyUtils.run(textView1,0);
。这有什么问题吗?
Update:
In TextJustifyUtils
我改变public static void justify(TextView textView)
into public static void run(TextView textView)
正如作者在那里评论的那样TextJustifyUtils.run(textView1,0);
into TextJustifyUtils.run(textView1);
在活动课上。但输出与我输入的内容相同textView
即没有理由的文本。
如果有人点击上述链接来调整文本,请选择选项 1。它工作正常。如果您有任何问题。向作者询问。我认为他总是很乐意帮助你的好人。因为他对我帮助很大。选项 1 只需要进行一些小的更改即可。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)