Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.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
Java 用于换行的Android Eclipse拆分_Java_Android_Eclipse - Fatal编程技术网

Java 用于换行的Android Eclipse拆分

Java 用于换行的Android Eclipse拆分,java,android,eclipse,Java,Android,Eclipse,在我的应用程序android中,我插入了: Log.i("myApp1", response.toString()); 这是Eclipse中LogCat for response.toString的输出: 04-08 20:54:21.674: I/myApp1(9930): 23/03/2014<br />Pics 1<br /><br /><br />09/03/2014<br />Pics 2<br /><br

在我的应用程序android中,我插入了:

Log.i("myApp1", response.toString());
这是Eclipse中LogCat for response.toString的输出:

04-08 20:54:21.674: I/myApp1(9930): 23/03/2014<br />Pics 1<br /><br /><br />09/03/2014<br />Pics 2<br /><br /><br />

在代码中使用
\n
,而不是HTML代码

String editedResponse = response.replaceAll("<br />", "\n");
Log.i("MyApp1", editedResponse);
String editedResponse=response.replaceAll(“
”,即“\n”); Log.i(“MyApp1”,editedResponse);
如果要在文本视图中显示此字符串,请确保将android:line设置为2或更大

<TextView
   android:id="@+id/txtTitlevalue"
   android:text="Line1: \n-Line2\n-Line3"
   android:layout_width="54dip"
   android:layout_height="fill_parent"
   android:lines="2"
   android:textSize="11px" />

好的,谢谢。现在,我有了这个输出
2014年3月23日
如何在布局android中使用此值设置textView?在textView中使用android:lines=“2”参数,在代码中只需说textTitleValue.setText(editedResponse);
<TextView
   android:id="@+id/txtTitlevalue"
   android:text="Line1: \n-Line2\n-Line3"
   android:layout_width="54dip"
   android:layout_height="fill_parent"
   android:lines="2"
   android:textSize="11px" />