How can I use marquee text in an android application?
+5
A:
android:ellipsize="marquee"
This only works when your TextView has the focus.
Maurits Rijk
2010-02-02 08:24:56
It also works when the TextView is selected.
Romain Guy
2010-02-02 08:57:34
thanks ...can u give me a example please?
RBADS
2010-02-02 11:33:34
He just did. You set `android:ellipsize="marquee"` on your `TextView`. It's all documented on developer.android.com by the way.
Matthias
2010-02-02 12:17:18
A:
Here is an example:
public class TextViewMarquee extends Activity {
private TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = (TextView) this.findViewById(R.id.tv);
tv.setSelected(true); // Set focus to the textview
}
}
The xml file with the textview:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/mywidget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:lines="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:textColor="#ff4500"
android:text="Simple application that shows how to use marquee, with a long text" />
</RelativeLayout>
droidgren
2010-08-30 08:16:44
A:
And is there a way to do it from the class java : by example:
TextView text = (TextView)findViewById(R.id.text); test.setEllipsize(where);
what is the "where"?
Tsunaze
2010-09-09 15:59:51