4

私の TextView は、指が画面に接触している場合にのみ、指が移動した距離だけスクロールします。TextViewでフリングスクロールを有効にする方法は?

 <TextView
    android:id="@+id/helloWorld"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="@string/hello_world"
    tools:context=".HelloWorld" 
    android:scrollbars="horizontal|vertical"
    android:scrollbarSize="@dimen/scrollBarSize"
    android:scrollbarFadeDuration="2000"/>

ここでいくつかのサンプル コードを見つけました: Androidでのテキスト行の縦スクロール

4

1 に答える 1

-7

ここでは、を使用したくありませんScrollView

xmlファイルで次の行を使用するだけです

android:maxLines = "AN_INTEGER"

android:scrollbars = "vertical"

TextViewレイアウトの xml ファイルのプロパティ。

次に使用します。

yourTextView.setMovementMethod(new ScrollingMovementMethod())

あなたのJavaコードで。

于 2013-07-21T04:55:40.733 に答える