子级中的ExpandableListView Seekbar

时间:2017-01-24 04:34:22

标签: java android listview expandablelistview seekbar

我有一个带有自定义适配器的ExpandableListView。我在每个组的单个孩子中添加了一个SeekBar。我能够扩展组和查看甚至滑动SeekBar。但是,我希望能够根据更改更改父组中TextView中的值。所以我的问题是,我如何从孩子中访问父组视图和TextView?

我尝试过:(在自定义BaseExpandableListAdapter中)

@Override
public View getChildView(final int groupPosition, int childPosition, boolean isLastChild, View convertView, final ViewGroup parent) {
    if (convertView == null) {
        convertView = minflater.inflate(R.layout.anassignmentsliderchild, parent, false);
    }
    SeekBar seekBar = (SeekBar) convertView.findViewById(R.id.assignmentSlider);
    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mainList.get(groupPosition).score = progress;
            notifyDataSetChanged();
/********************

I need something here instead of notifyDataSetChanged() that will change the child's parent's textview text, because all touches are lost when notifying

********************/
            }

@Override
public void onStartTrackingTouch(SeekBar seekBar) {

}

@Override
public void onStopTrackingTouch(SeekBar seekBar) {

}
});    
return convertView;
}

但是在更改时,由于通知,所有触摸都会丢失。

0 个答案:

没有答案