我有一个textView文本,每10秒由Runnable更新一次。添加选框效果后我遇到了问题。文本更新时,它会闪烁并显示在其他位置。我该怎么做才能改变字母?
TextView oneText = (TextView) findViewById(R.id.oneText);
oneText.setSelected(true);
handler = new Handler();
final Runnable r = new Runnable() {
public void run() {
try {
String bigstring = "Some text here";
oneText.setText(bigstring);
handler.postDelayed(this, 20 * 1000);
} catch (Exception e) {
Log.e(LOG_TAG, e.getMessage());
}
}
};
<TextView
android:id="@+id/oneText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="false"
android:scrollHorizontally="true"
android:text="@string/someString" />