0

我有一个搜索栏,并希望对其进行设置,以便它改变我的 doBrightness 方法的 int 值,这样当你滑动搜索栏时,它会改变图像的亮度。

这是 doBrightness 方法的开始,我想从 seekbar 更改 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?
        }
    });
4

1 回答 1

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
    }
});
于 2014-09-06T12:49:12.633 回答