0

我想在填充列表视图的活动中从适配器的 getveiw() 访问搜索栏。

适配器中的 getview():

if (convertView == null) {

        LayoutInflater inflator = context.getLayoutInflater();
        convertView = inflator.inflate(R.layout.row, null);
        viewHolder = new ViewHolder();
        viewHolder.seekbar= (SeekBar) convertView.findViewById(R.id.seekBar1);
        viewHolder.seekbar.setOnSeekBarChangeListener( myseekbarlistener);
        viewHolder.time_txt= (TextView) convertView.findViewById(R.id.textView1);
}           
4

2 回答 2

0

如果您想更新搜索栏进度,那么只需

viewHolder.seekbar.setProgress(value);

还是你的意思是别的?

于 2013-09-20T17:15:36.497 回答
0

试试这个,像这样创建一个构造函数

  public Top15Adapter(Top15Stocks top15Stocks, OnSeekBarChangeListener listner) {
    // TODO Auto-generated constructor stub
    this.OnSeekBarChangeListener = listher;
}


listher.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        private int progressChanged = 0;

        @Override
        public void onStopTrackingTouch(SeekBar arg0) {
            // TODO Auto-generated method stub
            Toast.makeText(Activityname.this,
                    "seek bar progress:" + progressChanged,
                    Toast.LENGTH_SHORT).show();
        }

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

        }

        @Override
        public void onProgressChanged(SeekBar arg0, int arg1,
                boolean fromuser) {
            // TODO Auto-generated method stub
            progressChanged = arg1;
        }
    });
于 2013-09-20T14:18:06.090 回答