Android ScrollView在SeekBar移动时重置

Android ScrollView在SeekBar移动时重置,android,scrollview,seekbar,Android,Scrollview,Seekbar,我有一个活动,它有一个自定义的布局,带有SeekBar和滚动视图。无论何时以编程方式移动seekbar,scrollview都会重置为top(这意味着只调用了布局),如何设置它以使scrollview不会重置 我也有同样的问题,到目前为止我还无法解决它 我尝试了几件事,比如在SeekBar onStartTrackingTouch期间,在我的滚动视图上设置称为quickScroll的scoll。这在设置滚动方面起到了作用,但每次seekBar上的进度发生变化时,ScrollView都会快速重置,

我有一个活动,它有一个自定义的布局,带有SeekBar和滚动视图。无论何时以编程方式移动seekbar,scrollview都会重置为top(这意味着只调用了布局),如何设置它以使scrollview不会重置

我也有同样的问题,到目前为止我还无法解决它

我尝试了几件事,比如在SeekBar onStartTrackingTouch期间,在我的滚动视图上设置称为quickScroll的scoll。这在设置滚动方面起到了作用,但每次seekBar上的进度发生变化时,ScrollView都会快速重置,然后返回到设置位置

@Override
    public void onStartTrackingTouch(SeekBar seekBar) {

            quickScroll.post(new Runnable() {
                @Override
                public void run() {

                    //quickScroll.requestDisallowInterceptTouchEvent(true);
                    //quickScroll.setEnabled(false);
                     quickScroll.scrollTo(0, 54);
                    // quickScroll.requestDisallowInterceptTouchEvent(true);
                } 
            });


    }
然而,在您可以看到的许多其他事情中,当在我的自定义视图组上调用onLayout时,它会将滚动重置为(0,0)。目前,每次按下按钮时都会调用my onLayout(),但只有在SeekBar发生更改时才会重置ScrollView。请告诉我您是否找到了解决方案。

您不应该一次又一次地创建行(在
getView()
方法中)

@Override
    public View getView(int position, View arg1, ViewGroup parent) {
        // TODO Auto-generated method stub

           LayoutInflater inflater = getLayoutInflater();
             View row = arg1;
             if(row==null)
                {
                row = inflater.inflate(R.layout.listview_item_row, parent, false);

                }
           //  Log.d("position", ""+str[position]);
                Button b1 = (Button)row.findViewById(R.id.btn);
                 final SeekBar s1 = (SeekBar)row.findViewById(R.id.seekBar1);
                //s1.setFocusable(true);
                b1.setText(str[position]);
                   b1.setOnClickListener(new OnClickListener()
                   {
                     public void onClick(View v) {

                       Toast.makeText(getApplicationContext(), "Progress is "+s1.getProgress()+"%", Toast.LENGTH_LONG).show();

                   }

                  });  

        return row;
}