在android中有没有适用于Marquee的例子?我浏览了一些网站,但这些例子都不起作用。
谢谢你的回答..但是下面的代码无论如何都不能正常工作。我使用的是Android 2.2。
<TextView
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:text="Marquee.."/> 发布于 2011-03-23 12:20:39
这很容易通过XML实现。使用以下设置:
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="false"
android:scrollHorizontally="true"如果您的TextView在RelativeLayout内,则宽度或高度必须是静态的(即32dp)。如果需要动态,请将TextView放在RelativeLayout中的另一个视图中。
在onCreate()中,您需要使TextView处于选中状态:
myTextView.setSelected(true);发布于 2012-09-13 01:45:10
您缺少的代码行是:
android:focusable="true"
android:focusableInTouchMode="true"
android:singleLine="true"在文本字段中,尝试此文本,因为它是一个很长的文本。
android:text="This is a very long text which is not fitting in the screen so it needs to be marqueed."检查我的完整代码并逐步处理here
发布于 2013-03-06 00:28:25
在java中,您忘记了这样做。
tv.setSelected(true);而xml将是
android:scrollHorizontally="true"
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="false"
android:marqueeRepeatLimit="marquee_forever"https://stackoverflow.com/questions/4344349
复制相似问题