我不知道它调用了什么类型的动画,但是我想实现它,如下所示。我在iOS上看过那个动画。

正如你所看到的,句子幻灯片取消将从左到右动画,就像它后面有一盏灯。
我不知道该用什么。我试过一些像Alpha这样的动画,但没能实现。有谁可以帮我?
发布于 2013-11-02 06:17:46
发布于 2014-07-09 13:24:49
这是另一个IOS类似的幻灯片文本效果,
发布于 2013-08-14 14:44:26
基于可扩展的解决方案
下面是线程类,它的运行间隔为100 ms。
class MyThread extends Thread {
//used for stopping thread
boolean flag;
//init flag to true so that method run continuously
public MyThread() {
flag = true;
}
//set flag false, if want to stop this thread
public void setFlag(boolean flag) {
this.flag = flag;
}
@Override
public void run() {
super.run();
while (flag) {
try {
Thread.sleep(intervalMiliSeconds);
runOnUiThread(new Runnable() {
@Override
public void run() {
Spannable spn = new SpannableString(txtView
.getText().toString());
spn.setSpan(new ForegroundColorSpan(Color.WHITE),
startPosition, endPosition,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
txtView.setText(spn);
startPosition++;
endPosition++;
endPosition %= (lengthOfString + charGaps);
startPosition %= lengthOfString;
if (startPosition == 0) {
endPosition = charGaps;
startPosition = 0;
}
if (endPosition > lengthOfString) {
endPosition = lengthOfString;
}
Log.d("Home", "Start : " + startPosition + " End : " + endPosition);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
}若要使用上述代码,请使用以下实现。
TextView txtView = (TextView) findViewById(R.id.txtView);
int charGaps = 3;
int startPosition = 0;
int endPosition = charGaps;
int lengthOfString = txtView.getText().length();
MyThread thread = new MyThread();
thread.start();输出

更好的答案会更受欢迎。:)
https://stackoverflow.com/questions/18230069
复制相似问题