public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Log.d(LOG_TAG, "onChildClick: " + childPosition);
Button btnPlay=(Button)v.findViewById(R.id.Play);
Button btnDelete=(Button)v.findViewById(R.id.Delete);
Button btnEmail=(Button)v.findViewById(R.id.Email);
btnPlay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Toast.makeText(FindFilesByType.this, "u clicked play btn", Toast.LENGTH_LONG).show();
}
});
in to above code i've made expandable list into that first i've put some content and if it expand,it displays 3 button..
PLAY,EMAIL and DELETE my problem is that it doesn't react on button click event what is i am missing? thank in advance -pragna
答案 0 :(得分:3)
嗯,我想,你应该在覆盖onClick
Button
getChildView()
public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
LinearLayout v = (LinearLayout) LayoutInflater.from(FindFilesByType.this).inflate(R.layout.row, null) ; //we assume your layout file name is row.xml
Button btnPlay=(Button)v.findViewById(R.id.Play);
Button btnDelete=(Button)v.findViewById(R.id.Delete);
Button btnEmail=(Button)v.findViewById(R.id.Email);
btnPlay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Toast.makeText(FindFilesByType.this, "u clicked play btn", Toast.LENGTH_LONG).show();
}
});
return v;
}