Reputation: 489
i am currently doing an android application which contains marquee with multiple textview and i want to show the contents of the textview when i click the textview .i have the code for marquee but it is not working in the case of multiple textview. i need the textview moving one after another not vertically.
plz help me.....
<?xml version="1.0" encoding="utf-8"?>
<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 for marquee with example as shown" />
<TextView
android:id="@+id/mywidget1"
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="haihaihaihaihaihaiahaiahaiahaiahaiahaiahaiahaiahaiahaiahiaha"
/>
</RelativeLayout>
java code
TextView tv = (TextView) this.findViewById(R.id.mywidget);
tv.setSelected(true);
TextView tv1 = (TextView) this.findViewById(R.id.mywidget1);
tv1.setSelected(true);
Upvotes: 2
Views: 3470
Reputation: 1530
To get it working one after another, create and start a new thread which programmatically sets the text views selected using setSelected(true) one by one with a set time interval of n microseconds between them which can be set using thread.sleep(n). Also don't forget to set all the text views initially unselected using setSelected(false). I have not tested this personally but I am pretty sure that it will work.
Upvotes: 0
Reputation: 722
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<TextView
android:id="@+id/mywidget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:lines="1"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:text="Simple application for marquee with example as shown"
android:textColor="#ff4500" />
<TextView
android:id="@+id/mywidget1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:lines="1"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:text="haihaihaihaihaihaiahaiahaiahaiahaiahaiahaiahaiahaiahaiahiaha"
android:textColor="#ff4500" />
</LinearLayout>
Try this once
Upvotes: 2