清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
import android.content.Context; import android.text.TextUtils.TruncateAt; import android.util.AttributeSet; import android.widget.TextView; public class MarqueTextView extends TextView { public MarqueTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(context); } public MarqueTextView(Context context, AttributeSet attrs) { super(context, attrs); init(context); } public MarqueTextView(Context context) { super(context); init(context); } private void init(Context context) { setEllipsize(TruncateAt.MARQUEE) ; } @Override public boolean isFocused() { return true; } }
<com.godinsec.seland.ui.tools.MarqueTextView android:id="@+id/tv_attention_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_weight="1" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true" android:marqueeRepeatLimit="marquee_forever" android:singleLine="true" android:text="XXXXXXXXXXXXXXXXXX" android:textColor="@color/textcolor_black_b2" android:textSize="@dimen/text_sp_s3" />