How to Make Ellipsize="Marquee" Always Scroll

Is there a way to make ellipsize= marquee always scroll?

I have been facing the problem and the shortest solution I have come up with is to create a new class derived from TextView.
The class should override three methods onFocusChanged, onWindowFocusChanged and isFocused to make the TextView all focused.

@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
if(focused)
super.onFocusChanged(focused, direction, previouslyFocusedRect);
}

@Override
public void onWindowFocusChanged(boolean focused) {
if(focused)
super.onWindowFocusChanged(focused);
}


@Override
public boolean isFocused() {
return true;
}

Can't find a way to make ellipsize=“marquee” always scroll using Fragments?

Solved the problem with scrolling by setting the weights to textViews:

<TableRow
android:id="@+id/tableRow5"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:text="@string/address_c"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:id="@+id/tv_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium" />

</TableRow>

...and a single line in the activity: tvFirstName.setSelected(true);

Text in Text View not scrolling even i set ellipsize= marquee in xml in android

You have to use android:scrollbars = "horizontal" in xml file, then use

tv.setMovementMethod(new ScrollingMovementMethod()); 

in your java code.

Ellipsize marquee/end

If you want to make your textview to scroll horizontally then ellipsize "marquee" will only work. Ellipsize "end" will help you to make your textview ellipsize with "..."

Making TextView scrollable on Android

You don't need to use a ScrollView actually.

Just set the

android:scrollbars = "vertical"

properties of your TextView in your layout's xml file.

Then use:

yourTextView.setMovementMethod(new ScrollingMovementMethod());

in your code.

Bingo, it scrolls!



Related Topics



Leave a reply



Submit