I want to use the feature of marquee in my android app and am using this code for achieving the goal:
<TextView
android:id="@+id/marqueetext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:lines="1"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:text="hello all how are you"
android:textColor="#ff4500"
/>
MarqueeText = (TextView)ShowTheMessages.this.findViewById(R.id.marqueetext);
MarqueeText.setSelected(true);
I don't know why it is not working.I have gone through many related posts but have not found the solution.Please help me.Thanks in advance.
change this line and try...
android:text="hello all how are you hello all how are you hello all how are you hello all how are you"
TextView txtView=(TextView) findViewById(R.id.marqueetext);
txtView.setSelected(true);
<TextView
android:id="@+id/marqueetext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:lines="1"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:text="hello all how are you hello all how are you hello all how are you hello all how are you"
android:textColor="#ff4500"
/>
or another example is...
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/marqueetext"
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="hello all how are you hello all how are you hello all how are you hello all how are you hello all how are you" />
</RelativeLayout>