【发布时间】:2013-02-23 06:30:05
【问题描述】:
我搜索了很多,但找不到任何可以帮助我了解的东西 如何在更改搜索栏时滚动编辑文本内容 当前位置和进度。
请帮忙.....
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);
}
【问题讨论】:
-
你确定你没有得到类似的东西吗??
-
我刚刚知道了如何使用搜索栏监听器,我尝试了一整天,但它不能正常工作。当我更改搜索栏时,编辑框没有滚动
-
看看下面的答案,希望对你有帮助。
标签: android android-layout android-widget android-edittext