문제

I want to apply Marquee on Arabic Text in a TextView. Following code works fine for English text, but does not work for Arabic text. Can anyone tell me how to fix it?

<TextView
            android:id="@+id/tVMessage"
            style="@style/tVMessage"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:textDirection="anyRtl"
            android:text="Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye" />


<style name="tVMessage">
        <item name="android:lines">1</item>
        <item name="android:ellipsize">marquee</item>
        <item name="android:fadingEdge">horizontal</item>
        <item name="android:marqueeRepeatLimit">marquee_forever</item>
        <item name="android:scrollHorizontally">true</item>
        <item name="android:focusable">true</item>
        <item name="android:focusableInTouchMode">true</item>
        <item name="android:textColor">#ffffff</item>
    </style>
도움이 되었습니까?

해결책

use this programmatically not from xml:

textView.setSingleLine(true);
textView.setEllipsize(TruncateAt.MARQUEE);
textView.setFocusableInTouchMode(true);
textView.setFreezesText(true);
textView.setMarqueeRepeatLimit(-1);
textView.setFocusable(true);
textView.setSelected(true);

With xml you use this :

<TextView
            android:id="@+id/tVMessage"
            style="@style/tVMessage"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:textDirection="anyRtl"
            android:singleLine="true"
            android:text="Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye" />

use single line in your xml.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top