1

次の属性を持つ TextView があります。

<TextView
        android:id="@+id/appheader" 
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_centerVertical="true"
        android:textColor="#ffffff"
        android:layout_marginLeft="3dp"
        android:textSize="21sp"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit="marquee_forever"
        android:scrollHorizontally="true"
        android:focusable="true"
        android:focusableInTouchMode="true"/> 

実際には、TextView をクリックしたときにのみ TextView がスクロールします。しかし、アクティビティを起動したときに自動的にスクロールしたいです。これどうやってするの ?

4

3 に答える 3

2
<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="very long text to srollll dkfjadkfjkldjfkjdkghjhtudhfjhdjfkdfkadjsajekdfjak" 
    android:singleLine="true" 
    android:marqueeRepeatLimit="marquee_forever" 
    android:ellipsize="marquee"
    android:focusable="true" 
    android:focusableInTouchMode="true"/>
于 2012-04-23T07:47:19.267 に答える
1

デフォルトTextViewでは、フォーカスを取得するとマーキー効果が機能します。TextView自動マーキー効果を作成するには、クラスを拡張する必要があります。参考までに、このリンクを参照してください。

于 2012-04-23T07:36:44.137 に答える