Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/179.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 滚动字幕并更新文本_Android_Textview - Fatal编程技术网

Android 滚动字幕并更新文本

Android 滚动字幕并更新文本,android,textview,Android,Textview,我有一个文本视图,文本由Runnable每10秒更新一次。添加字幕效果后,我遇到了一个问题。当文本更新时,它会闪烁并显示在其他位置。我怎样才能改变字母呢 TextView oneText = (TextView) findViewById(R.id.oneText); oneText.setSelected(true); handler = new Handler(); final Runnable r = new Runnable() {

我有一个文本视图,文本由Runnable每10秒更新一次。添加字幕效果后,我遇到了一个问题。当文本更新时,它会闪烁并显示在其他位置。我怎样才能改变字母呢

        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" />
TextView-oneText=(TextView)findViewById(R.id.oneText);
oneText.setSelected(true);
handler=新的handler();
最终可运行r=新可运行(){
公开募捐{
试一试{
String bigstring=“此处有一些文本”;
setText(bigstring);
handler.postDelayed(此值为20*1000);
}捕获(例外e){
Log.e(Log_标记,e.getMessage());
}
}
};

您正在描述一个问题,因此需要将代码放入Q中进行查看。在此处查看可能的解决方案--