I have not found a solution for my problem, maybe you can help me here.
I am using a RelativeLayout with an ImageView and a TextView as children. The TextView contai
just a simple Fix..:) no need to worry much...just fix width of textview as some 800dp or too higher width. it will solve reset issue
<TextView
android:id="@+id/adv_txt_view"
android:layout_width="800dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:singleLine="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:focusableInTouchMode="true"
android:focusable="true"
android:scrollHorizontally="true"
android:textColor="@color/black"
android:text="large text to scroll!!" />
I had a same problem and I fixed it just now:)
If your TextView which in layout XML contains layout_weight
android:layout_weight="1"
Remove it!This attibute cause marquee restart.
Hope helpful:)
See my answer here : https://stackoverflow.com/a/13841982/1823503
The idea is :
The marquee reset problem is because of loss of focus of the TextView on which it is running. To overcome these issues you can simply surround your TextView with another RelativeLayout
so that it is in a different ViewGroup as your other views.
You have another option: Create a new class that is a subclass of TextView and override onFocusChanged
and onWindowFocusChanged
to prevent loss of focus for the said textview.
That's it. Using these techniques your marquee won't restart every time another element gains focus.