Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 对正文本视图中的文本工作不正常_Android_Github_Textview - Fatal编程技术网

Android 对正文本视图中的文本工作不正常

Android 对正文本视图中的文本工作不正常,android,github,textview,Android,Github,Textview,我是在参考。我正在上述链接中实施选项2。当我在emulator上运行我的应用程序时,文本在一行中显示一个单词,在下一行中显示下一个单词,依此类推。我不知道我的代码出了什么问题。请帮帮我。谢谢 活动类别代码- textView1 = (TextView) findViewById (R.id.textView1); textView1.setMovementMethod(new ScrollingMovementMethod()); textView1.getVie

我是在参考。我正在上述链接中实施选项2。当我在emulator上运行我的应用程序时,文本在一行中显示一个单词,在下一行中显示下一个单词,依此类推。我不知道我的代码出了什么问题。请帮帮我。谢谢

活动类别代码-

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)的链接中做了一个更改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的任何其他方法。好的,那么怎么做呢?