2

テキストを折り返さないTextViewを作成し、垂直/水平スクロールを許可したいですか?ここで説明するソリューションは、4.0.3では機能しなくなりました。

4.xの解決策はありますか?

4

1 に答える 1

5

HorizontalScrollView水平スクロール用にテキストをにラップします。

 <?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/text_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:singleLine="false"
        android:maxLines="3"
        android:scrollbars="vertical"
        android:textColor="@android:color/secondary_text_dark_nodisable"
        >
    </TextView>
</HorizontalScrollView>

垂直スクロールには。を使用しますScrollView

また、このXMLは、参照した回答から取得したものです。

于 2012-08-27T16:30:43.977 に答える