Android TextView文本仅在Gingerbread中切断

时间:2012-10-14 16:19:08

标签: android layout textview scrollview android-2.3-gingerbread

我的应用程序中的布局是使用SDK 16构建的,我已经测试并确认它们在ICS和JB上运行良好,但GB有以下问题:

在下面的代码中,我只想创建一个只包含文本的简单布局。虽然文字在第一行末尾的姜饼上被切断,但不会进入下一行。我已经尝试将singeLine设置为false,使用直线,maxLines,marquee,layoutWeight,将layoutHeight和layoutWidth更改为每个可以想象的组合等等。这个问题真的让我感到困惑。

代码: -

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

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">

<TextView
    android:id="@+id/textView7"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Text keeps overflowing"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="#33B5E5"
    android:paddingTop="6dp"
    />

<TextView
    android:id="@+id/textView8"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Text gets cut off when I input a long string like this one"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="#FFFFFF"
    />

</LinearLayout>

</ScrollView>

另外,如果我将布局的主题更改为Gingerbread,我会收到错误:

Failed to find style 'scrollViewStyle' in current theme
Failed to find style 'textViewStyle' in current theme
android.content.res.Resources$NotFoundException

提前致谢。

1 个答案:

答案 0 :(得分:2)

我自己修好了。无法找出原因,但我通过在TextViews的代码中添加以下行来修复它: -

        android:ellipsize="none"
        android:maxLines="10"
        android:scrollHorizontally="false"
相关问题