Android XML中的新行(\ n)。 Android 4.1 SDK兼容性问题?

时间:2012-07-11 22:49:14

标签: android xml layout newline

我遇到了这个奇怪的问题。

在我的布局xml上,我有一个TextView,其中包含以下文字:

欢迎使用strings.xml中定义的应用。\ n ”。

在运行4.0的平板电脑中显示完整的字符串。

在运行2.3.7的智能手机中,它显示在\n

之前

在我之前创建的应用中,\n工作正常。

有人遇到过类似的事吗?

XML代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/textViewWelcomeNotes"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="false"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="false"
        android:layout_margin="15dp"
        android:layout_marginTop="20dp"
        android:fitsSystemWindows="false"
        android:focusableInTouchMode="true"
        android:gravity="center_vertical|center_horizontal"
        android:hint="@string/msgWelcomeNotesHint"
        android:paddingTop="10dp"
        android:text="@string/msgWelcomeNotes"
        android:textSize="14dp" />

</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

这是ADT 20.0中最新Eclipse Juno的奇怪错误。

我全新安装了Eclipse Juno,因为我用插件大量加载它, 现在\n在2.3和4.0+ Android版本的同一个apk中显示正常。

此ADT上还存在其他一些错误,例如在创建新活动(New->Other->Android Activity)时。