【发布时间】:2010-06-02 11:20:34
【问题描述】:
我想要一个带有水平滚动的简单 TextView,我知道我为此使用了 HorizontalScrollview,并且我希望文本能够连续自动滚动。这可能吗?
【问题讨论】:
标签: android textview autoscroll horizontalscrollview
我想要一个带有水平滚动的简单 TextView,我知道我为此使用了 HorizontalScrollview,并且我希望文本能够连续自动滚动。这可能吗?
【问题讨论】:
标签: android textview autoscroll horizontalscrollview
您可以在 TextView 属性中使用 android:ellipsize="marquee" 或实现您自己的动画
【讨论】:
这是一个简单的使用 XML 自动滚动文本视图的小例子,无需编写 Java 代码。希望你会喜欢!自己试试,很容易上手
试试这个:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="This is small example for auto scroll text view simply using XML, no need to code Java. Hope you like it! Try it on your own, it is very easy to perform" />
这里的文字会自动滚动,你会得到无限滚动。玩得开心!
【讨论】: