簡體   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