首页
IT
登录
6mi
u
盘
搜
搜 索
IT
文字滚动
文字滚动
xiaoxiao
2026-09-12
4
重写isFocused方法,让控件一直获取焦点
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.widget.TextView
;
public class
RollTextView
extends
TextView
{
public
RollTextView
(
Context
context
) {
super
(
context
)
;
}
public
RollTextView
(
Context
context
,
AttributeSet
attrs
) {
super
(
context
,
attrs
)
;
}
public
RollTextView
(
Context
context
,
AttributeSet
attrs
, int
defStyle
) {
super
(
context
,
attrs
,
defStyle
)
;
}
@Override
public boolean
isFocused
() {
return true;
}
}
<
com.dofun.dofunfm.view.custom.
RollTextView
android:id=
"@+id/message"
android:layout_width=
"500dp"
android:layout_height=
"35dp"
android:layout_centerHorizontal=
"true"
android:textColor=
"@color/white"
android:textSize=
"@dimen/home_dofun__margin_26"
android:layout_marginTop=
"@dimen/home_dofun__margin_80"
android:singleLine=
"true"
android:ellipsize=
"marquee"
android:marqueeRepeatLimit=
"marquee_forever"
/>
转载请注明原文地址: https://ju.6miu.com/read-1311998.html
最新回复
(
0
)