Vertical Seekbar setProgress not working

Seek is not progressing. All seekbar comes to zero but textView shows value properly..

choosePreset.setOnClickListener(new OnClickListener()
{
    @Override
    public void onClick(View arg0)
    {   
        LayoutInflater inflater = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE));
        View customView = inflater.inflate(R.layout.preset_list, null, false);
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setView(customView);

        final String[] arr= getEqualizerPresets();

        ArrayAdapter<String> namesAA= new ArrayAdapter<String> ( context,R.layout.myitemlist,arr );
        ListView list = (ListView) customView.findViewById(R.id.mylist);
        list.setAdapter(namesAA);

        final AlertDialog ad = builder.create();

        list.setOnItemClickListener(new OnItemClickListener() 
        {
            public void onItemClick(AdapterView<?> parent, View view, final int position, long id) 
            {
               Toast.makeText(context, "Position"+position, Toast.LENGTH_LONG).show();

               //equalizerWrapper.usePreset((short)arr[position]);

                    for(int v=0;v<eqSeeks.length;v++)
                    {
                    //  equalizerSeeks(v, eqSeeks[v]);
                        final int z = v;
                        eqSeeks[v].post(new Runnable()
                        {

                            @Override
                            public void run()
                            {
                                eqSeeks[z].setProgress( EQValues.presetValues[position][z]);
                            }
                        });

                    }

            //   eqSeeks[2].setProgress(150);

               setEqualizerPreset(position);

               ad.dismiss();

            }
        });

        ad.show();
    }
});

EQValues.presetValues[position][z] are showing in textView properly but seekbars are not reaching to the progress . I tried many ways but nothing working.

I tried using handler and also use postMethod as shown. But seekBars not reached to values.

Edit

i find a answer to add updateThumb method to Vertical seekbar but it is also not working. This issue is due to vertical seekbar.

public void updateThumb(){
     onSizeChanged(getWidth(), getHeight(), 0, 0);
}

And then call update thumb method after setting progress.

seekBar.setProgress((int) progress);
seekBar.updateThumb();

but this still didn't solve my problem


I am facing some other problem. but the given statement works.

Add updateThumb method in VerticalSeekbar class like

public void updateThumb()
{
     onSizeChanged(getWidth(), getHeight(), 0, 0);
}

And then call update thumb method after setting progress.

seekBar.setProgress((int) progress);
seekBar.updateThumb();

This is actually better :

@Override
public void setProgress(int progress) {
    super.setProgress(progress);
    onSizeChanged(getWidth(), getHeight(), 0, 0);
}

Now setProgress() method should work fine.

链接地址: http://www.djcxy.com/p/88600.html

上一篇: ProgressPar在MediaPlayer播放时被阻止

下一篇: 垂直Seekbar setProgress不工作