@Override
public View getChildView(int groupPosition, final int position,
boolean arg2, View convertView, ViewGroup parent) {
convertView = LayoutInflater.from(context).inflate(R.layout.list_item,
null)
button = (Button) convertView.findViewById(R.id.btn_delete)
textView = (TextView) convertView.findViewById(R.id.text)
frontView = convertView.findViewById(R.id.id_front)
frontView.setOnClickListener(new OnClickListener() {
//因为重写ontouch事件使onChildClickListener失效,需要设置次监听来补救
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(context, position + "条目按下", Toast.LENGTH_SHORT)
.show()
}
})
new FrontViewToMove(frontView, listView)
//关键语句,使用自己写的类来对frontView的ontouch事件复写,实现视图滑动效果
button.setOnClickListener(new OnClickListener() {
// 为button绑定事件,可以用此按钮来实现删除事件
@Override
public void onClick(View v) {
Toast.makeText(context, position + "按钮按下", Toast.LENGTH_SHORT)
.show()
}
})
textView.setTextSize(20)
textView.setTextColor(Color.DKGRAY)
textView.setText(ChildrenItem[groupPosition][position])
return convertView
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)