繁体   English   中英

无法在Android 4.3上换行TextView文本

[英]TextView text not wrapping on Android 4.3

我有一个包含Textview的RelativeLayout。 我希望TextView文本换行。

它在Android 4.1和4.2上运行良好(尚未尝试使用较早版本)。 但是,在Android 4.3上,文本不会自动换行并被剪切(请参见下面的屏幕截图)。

Layout.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/feed_item"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/touchable_background_msf"
    android:padding="@dimen/feed_item_padding" >

    <com.binarymango.msfnews.images.RecyclingImageView
        android:id="@+id/feed_item_icon"
        android:layout_width="@dimen/feed_thumb_width"
        android:layout_height="@dimen/feed_thumb_height"
        android:contentDescription="Description" />

    <TextView
        android:id="@+id/feed_item_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/feed_item_icon"
        android:layout_alignLeft="@+id/feed_item_icon"
        android:layout_alignRight="@+id/feed_item_icon"
        android:background="@color/text_background_msf"
        android:ellipsize="end"
        android:maxLines="3"
        android:minLines="2"
        android:padding="@dimen/feed_item_text_padding"
        android:text="Description"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@color/text_msf" />

</RelativeLayout>

在Android 4.2上显示结果,该文本正确地分为3行: 在此处输入图片说明

但是在Android 4.3上,文本被剪切: 在此处输入图片说明

我一直在尝试徒劳地使用StackOverflow中其他地方提到的几个属性:

android:singleLine="false"
android:scrollHorizontally="false"
android:inputType="textMultiLine"
android:width="0dip"

另外,我怀疑这可能与主题有关。 我的应用程序使用Theme.AppCompat.Light

例如,您可以使用android:line="3"与第一张图片具有相同的行为。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM