Android 对正文本视图中的文本工作不正常
我是在参考。我正在上述链接中实施选项2。当我在emulator上运行我的应用程序时,文本在一行中显示一个单词,在下一行中显示下一个单词,依此类推。我不知道我的代码出了什么问题。请帮帮我。谢谢 活动类别代码-Android 对正文本视图中的文本工作不正常,android,github,textview,Android,Github,Textview,我是在参考。我正在上述链接中实施选项2。当我在emulator上运行我的应用程序时,文本在一行中显示一个单词,在下一行中显示下一个单词,依此类推。我不知道我的代码出了什么问题。请帮帮我。谢谢 活动类别代码- textView1 = (TextView) findViewById (R.id.textView1); textView1.setMovementMethod(new ScrollingMovementMethod()); textView1.getVie
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)中进行更改代码>。这有什么问题吗
更新:
在TextJustifyUtils
中,我将public static void justify(TextView TextView)
更改为public static void run(TextView TextView)
,如作者所评论,并将TextJustifyUtils.run(textView1,0)
进入TextJustifyUtils.run(textView1)代码>在活动类中。但是输出与我在我的文本视图中键入的文本相同,即没有对齐的文本。如果有人按照上述链接对齐文本,请选择选项1。它的工作很好。如果你有什么问题。问作者。我想他总是很乐意帮助你这个好人。因为他帮了我很多。选项1进行了一些小的修改。但是为什么要删除这个问题呢?你知道使用textview而不是webview的任何其他方法。好的,那么怎么做呢?