Skip to content

Instantly share code, notes, and snippets.

@svenkapudija
Created November 29, 2012 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svenkapudija/4171444 to your computer and use it in GitHub Desktop.
Save svenkapudija/4171444 to your computer and use it in GitHub Desktop.
Scrollable TextView
public class ScrollableTextView extends TextView {
public ScrollableTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
rotate();
}
public ScrollableTextView(Context context, AttributeSet attrs) {
super(context, attrs);
rotate();
}
public ScrollableTextView(Context context) {
super(context);
rotate();
}
private void rotate() {
setSelected(true);
}
}
// Also be sure to use this class instead regular TextView in your XML layout
/*
<com.my.custom.ScrollableTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="My dummy text" />
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment