TextView跑马灯效果不生效
<TextView
android:id="@+id/music_name_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee" 【必须】
android:focusable="true" 【必须】
android:focusableInTouchMode="true" 【必须】
android:lines="1" 【必须】
android:text=""
android:textColor="@color/colorAccent"
android:textSize="15sp" />
public static void setTextMarquee(TextView textView) {
if (textView != null) {
textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
textView.setSingleLine(true);
textView.setSelected(true);
textView.setFocusable(true);
textView.setFocusableInTouchMode(true);
}
}