Horizontal scrolling text in Android

前端 未结 5 2047
抹茶落季
抹茶落季 2020-12-05 05:53

I\'ve been looking around for quite some time now, and I can\'t get a straight answer for my question.

It\'s quite simple: How can I get a nice scrolling text just l

5条回答
  •  生来不讨喜
    2020-12-05 06:53

    1. Use a normal TextView with the following config:

      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" />
      

    The problem with this is that you cannot adjust the speed of the scrolling text.

    1. Enclose a TextView within a ScrollView:

        
                
            
        

    1. Create custom class and follow this thread

提交回复
热议问题