Marquee不是滚动整个文本,也不是每秒重复 您好,我正在使用选框滚动文本。但它只滚动了一秒钟,并没有滚动整个文本。请建议我。 这是我的textview代码:`
android:gravity="center_vertical"
android:layout_alignParentBottom="true"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:id="@+id/ticker1"
android:textColor="#FFF"
android:textSize="20sp"
android:textStyle="bold"
android:text=""
android:layout_gravity="center_vertical"
android:singleLine="true"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:focusable="true"
android:focusableInTouchMode="true"
/>
</LinearLayout>`
答案 0 :(得分:0)
您可能有一些代码取消了TextView的焦点。我已经尝试过类似的东西来复制你的问题了,但它确实有效。
myTextView.setSelected(true);
Runnable r = new Runnable() {
@Override
public void run(){
myTextView.setSelected(false);
}
};
Handler h = new Handler();
h.postDelayed(r, 5000);
这会在文本开始后停止滚动5秒。在您的代码中搜索可以执行此类操作的内容。
答案 1 :(得分:0)