我进行了很多搜索,但找不到任何可以帮助我了解如何根据当前位置和进度在搜索栏更改时滚动编辑文本内容的内容。
请帮忙.....
public void startScrollingText() {
timer = new Timer();
System.out.println(CurrentValues.cur_script_speed
+ "its a current speed");
script_speed = (int) (100 - CurrentValues.cur_script_speed);
timer.schedule(new TimerTask() {
@Override
public void run() {
MainActivity.this.runOnUiThread(new Runnable() {
public void run() {
final Layout layout = script.getLayout(); // System.out.println(textview.getScrollY());
if (layout != null) {
int scrollDelta = layout.getLineBottom(script
.getLineCount() - 1)
- script.getScrollY()
- script.getHeight();
// System.out.println(scrollDelta);
if (scrollDelta > 0)
script.scrollTo(0, script.getScrollY() + 5);
// else
// script.scrollTo(0, 0);
System.out.println(CurrentValues.cur_script_speed
+ " current speed");
}
}
});
}
}, 1000, script_speed + 1);
}