10

私はかなり前から周りを見回していて、私の質問に対する正解を得ることができません。

非常に簡単です。アプリケーションを選択したときに、マーケットにある長いアプリ名のように、スクロールするテキストを取得するにはどうすればよいですか。

4

5 に答える 5

16

私はそれを自分で理解しました。

android:ellipsize="marquee"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
于 2010-10-05T11:15:12.870 に答える
8

次のように、animフォルダーに翻訳アニメーションを作成します。

<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="12000"
    android:fromXDelta="100"
    android:interpolator="@android:anim/linear_interpolator"
    android:repeatCount="infinite"
    android:repeatMode="restart"
    android:toXDelta="-100" />

そして、次のようなテキストビューに移動します。

yourtextview.startAnimation((Animation)AnimationUtils.loadAnimation(Context,R.anim.youranim_xml));

これがお役に立てば幸いです。

編集:

これを試して:

<TextView 
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:lines="1"
android:marqueeRepeatLimit="marquee_forever"
android:padding="4dp"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="Simple application that shows how to use marquee, with a long text" />
于 2012-05-03T21:40:38.620 に答える
6

私のために働く決定:

textView.setSelected(true); 
textView.setEllipsize(TruncateAt.MARQUEE);
textView.setSingleLine(true);

フォーカス可能なパラメータなし

于 2012-01-19T19:55:09.557 に答える
0
android:ellipsize="marquee"
于 2010-10-05T09:41:57.147 に答える
0
  1. 次の設定で通常のTextViewを使用します。

    android:text="your text here"
    android:id="@+id/MarqueeText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:singleLine="true"
    android:ellipsize="marquee"
    android:scrollHorizontally="true"
    android:focusable="true"
    android:focusableInTouchMode="true" />
    

これに伴う問題は、スクロールするテキストの速度を調整できないことです。

  1. で囲みTextViewますScrollView

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
            <TextView
            android:id="@+id/myTextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Your Text here" >
        </TextView>
    </ScrollView>

  1. カスタムクラスを作成し、このスレッドに従ってください
于 2016-11-04T06:11:57.340 に答える