Seekbar更改int的值

时间:2014-09-06 11:48:10

标签: android int android-seekbar

我有一个搜索栏并且想要设置它以便它会改变我的doBrightness方法的int值,这样当你滑动搜索条时,它会改变图像的亮度。

这是doBrightness方法的开始,我想从搜索栏更改int的值:

我怎样才能实现这个目标?

public Bitmap doBrightness(Bitmap src, int value) {
           .....................
  }

这是我设置的搜索栏:

sb = (SeekBar)v.findViewById(R.id.seekBar1);

    sb.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress,
                boolean fromUser) {
            // TODO Auto-generated method stub


            sb.setProgress(0);
            sb.setMax(100);

            //Change the int value of the doBrightness from here?
        }
    });

1 个答案:

答案 0 :(得分:0)

sb = (SeekBar)v.findViewById(R.id.seekBar1);
sb.setProgress(0);
sb.setMax(100);

sb.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onProgressChanged(SeekBar seekBar, int progress,
            boolean fromUser) {
        // TODO Auto-generated method stub

        //doBrightness change here
    }
});