Skip to content

Instantly share code, notes, and snippets.

@svenporto
Created November 29, 2012 19:56
Show Gist options
  • Save svenporto/4171444 to your computer and use it in GitHub Desktop.
Save svenporto/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