10

我已经四处寻找了很长一段时间,但我无法得到我的问题的直接答案。

这很简单:当您选择一个应用程序时,如何获得一个漂亮的滚动文本,就像市场中的长应用程序名称一样?

4

5 回答 5

16

我自己想通了。

android:ellipsize="marquee"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
于 2010-10-05T11:15:12.870 回答
8

在您的动画文件夹中制作翻译动画,例如:

<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" />
于 2012-05-03T21:40:38.620 回答
6

对我有用的决定:

textView.setSelected(true); 
textView.setEllipsize(TruncateAt.MARQUEE);
textView.setSingleLine(true);

没有可聚焦的参数

于 2012-01-19T19:55:09.557 回答
0
android:ellipsize="marquee"
于 2010-10-05T09:41:57.147 回答
0
  1. 使用具有以下配置的普通 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" />
    

这样做的问题是您无法调整滚动文本的速度。

  1. 将 a 括TextView在 a 中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>

  1. 创建自定义类并关注此线程
于 2016-11-04T06:11:57.340 回答