import android.content.Context; import android.graphics.Rect; import android.text.TextUtils; import android.util.AttributeSet; import android.widget.TextView; /** * Created by Naresh Katta */ public class MarqueeTextView extends TextView { public MarqueeTextView(Context context) { super(context); init(); } public MarqueeTextView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public MarqueeTextView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } private void init() { setEllipsize(TextUtils.TruncateAt.MARQUEE); setMarqueeRepeatLimit(-1); setSelected(true); } @Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { if (focused) super.onFocusChanged(true, direction, previouslyFocusedRect); }
@Override
public void onWindowFocusChanged(boolean focused) { if (focused) super.onWindowFocusChanged(true); }
@Override
public boolean isFocused() { return true; }
//note this file has some limitations see comments of this answer for more details of limitations }
Tuesday, 2 February 2016
Android Auto Horizontal Scrolling TextView (marquee)
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment