Android 多行文本视图不处理换行符
由于某些原因,“我的多行文字视图”没有作为新行字符处理。我做错什么了吗?我已尝试使用Android 多行文本视图不处理换行符,android,textview,newline,Android,Textview,Newline,由于某些原因,“我的多行文字视图”没有作为新行字符处理。我做错什么了吗?我已尝试使用.setText()设置一个包含多个“\n”实例的字符串,但该字符串仅显示为一行,\n可见为文本 这是我的文本视图 <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textMultiLine" android:ems="1
.setText()
设置一个包含多个“\n”实例的字符串,但该字符串仅显示为一行,\n可见为文本
这是我的文本视图
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:ems="10"
android:id="@+id/noteText"
android:layout_marginTop="30dp"
android:maxHeight="200dp"
android:layout_below="@+id/ActivityTitle"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:editable="false"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
/>
你能告诉我你是如何调用setText的吗?你是使用双引号还是单引号?刚刚发布了一个。结果在前面设置为“Testing\nTest”InputType to Multiline本身为您提供了键盘上的输入按钮。那么有其他方法吗?>请确保您设置了android:maxLines,并尝试在模拟器或实际设备上运行它,确保它仍然以这种方式运行。您可以显示一段如何调用setText的代码吗,你使用双引号/单引号吗?刚刚发布了一个。结果在前面设置为“Testing\nTest”InputType to Multiline本身为您提供了键盘上的输入按钮。那么有其他方法吗?>请确保您设置了android:maxLines,并尝试在模拟器或实际设备上运行它,确保它仍以这种方式运行
noteText.setText(result);
//result == "Testing\nTest"