滚动edittext内容改变搜索栏

时间:2013-02-23 06:30:05

标签: android android-layout android-widget android-edittext

  

我搜索了很多,但找不到任何能让我知道的东西   如何在搜索栏的变化上滚动编辑文本内容   目前的立场和进展。

     

请帮助.....

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);
}

1 个答案:

答案 0 :(得分:0)

如果你有SeekBar工作和EditText初始化,那么你必须知道值会随着下面的方法而改变。

这就是你应该做的,

public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
               yourEditText.setText("changing values are "+progress);
            }