私はかなり前から周りを見回していて、私の質問に対する正解を得ることができません。
非常に簡単です。アプリケーションを選択したときに、マーケットにある長いアプリ名のように、スクロールするテキストを取得するにはどうすればよいですか。
私はかなり前から周りを見回していて、私の質問に対する正解を得ることができません。
非常に簡単です。アプリケーションを選択したときに、マーケットにある長いアプリ名のように、スクロールするテキストを取得するにはどうすればよいですか。
私はそれを自分で理解しました。
android:ellipsize="marquee"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
次のように、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" />
私のために働く決定:
textView.setSelected(true);
textView.setEllipsize(TruncateAt.MARQUEE);
textView.setSingleLine(true);
フォーカス可能なパラメータなし
android:ellipsize="marquee"
次の設定で通常の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" />
これに伴う問題は、スクロールするテキストの速度を調整できないことです。
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>