例えばTextViewに「Uploading」というテキストを表示すると、「Uploading ...」というテキストが表示され、3点が削除され、静的テキストだけでなく何かを処理しているように再表示されます。アンドロイドスタジオのテキストをアニメーションにするにはどうすればよいですか?
私はMainActivity onTouchイベントでこれを持っている:
@Override
public boolean onTouchEvent(MotionEvent event)
{
float eventX = event.getX();
float eventY = event.getY();
float lastdownx = 0;
float lastdowny = 0;
switch (event.getAction())
{
case MotionEvent.ACTION_DOWN:
lastdownx = eventX;
lastdowny = eventY;
Thread t = new Thread(new Runnable()
{
@Override
public void run()
{
byte[] response = null;
if (connectedtoipsuccess == true)
{
if (is_start == true)
{
uploadTimerBool = true;
timers.StartTimer(timerValueRecord, "Recording Time: ");
response = Get(iptouse + "start");
is_start = false;
} else
{
timers.StopTimer(timerValueRecord);
textforthespeacch = "Recording stopped and preparing the file to be shared on youtube";
MainActivity.this.runOnUiThread(new Runnable()
{
@Override
public void run()
{
status1.setText("Preparing the file");
}
});
MainActivity.this.initTTS();
response = Get(iptouse + "stop");
is_start = true;
startuploadstatusthread = true;
servercheckCounter = 0;
}
if (response != null)
{
try
{
a = new String(response, "UTF-8");
MainActivity.this.runOnUiThread(new Runnable()
{
@Override
public void run()
{
if (a.equals("Recording started"))
{
status1.setText("Recording");
}
if (a.equals("Recording stopped and preparing the file to be shared on youtube"))
{
status1.setText("Recording Stopped");
}
}
});
textforthespeacch = a;
MainActivity.this.initTTS();
} catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
Logger.getLogger("MainActivity(inside thread)").info(a);
}
}
}
});
t.start();
return true;
case MotionEvent.ACTION_MOVE:
break;
case MotionEvent.ACTION_UP:
break;
default:
return false;
}
return true;
}
この行を:代わりに、私はそれが表示されることを確認するためにどのように思っていた「ファイルの準備」のみ静的なテキストを表示
status1.setText("Preparing the file");
「ファイルの準備中...」、「ファイルの準備中...」、「ファイルの準備中」などの移動ポイントのようなものです。もう一度 "ファイルの準備中..."、 "ファイルの準備中"などとなります。
"アップロード中"、 "アップロード中"、 "アップロード中です"、 "アップロード中..."(文字列配列から取ったもの)の繰り返しシーケンスを表示するだけです間に少しの遅れがあります。 –