I have a an activity which has a custom layout, with SeekBar and a ScrollView. Whenever I move the seekbar programmatically, the scrollview resets to top ( meaning onLayout gets called ), how do I set it so that the ScrollView doesn't get reset ?
you should not create row (in getView()
method) again and again..
@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;
}