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
Telephonymanager.Getline1Number() Failing
How to Change Color of Button in Android When Clicked
How to Customize Snackbar's Layout
How to Display Toast in Android
Android: Java.Lang.Securityexception: Permission Denial: Start Intent
How to Detect Swipe Direction Between Left/Right and Up/Down
What Is Activity.Finish() Method Doing Exactly
How to Programmatically Create and Read Wep/Eap Wifi Configurations in Android
How to Customize a Spinner in Android
Android Background Music Service
Overriding the Home Button - How to Get Rid of the Choice
Android Read Text Raw Resource File
Android Intent for Twitter Application
Android "Elevation" Not Showing a Shadow
Boot_Completed Not Working Android
Html.Fromhtml Deprecated in Android N
Error:(1, 0) Plugin With Id 'Com.Android.Application' Not Found