我使用的是ExpandableListView小部件中更改組視圖。當單擊組視圖時,除了顯示子視圖外,我還想對組視圖進行更改。我在適配器的getGroupView增加了一個OnClickListener到組的意見()方法,但是當點擊其中的一個,更改到組視圖被提出,但孩子的觀點不顯示 - 它猶如OnClickListener覆蓋放映的孩子的意見。有沒有可以添加到OnClickListener以顯示子項的呼叫?沒有其他的想法,歡迎...ExpandableListView上點擊
編輯:下面是getGroupView()方法的代碼,與OnClickListener增加。我不認爲任何其他代碼的相關考慮到當OnClickListener被註釋掉
@Override
public View getGroupView(int position, boolean arg1, View convertView,
ViewGroup arg3) {
if (convertView == null){
convertView = getLayoutInflater().inflate(R.layout.questionbox, null);
}
TextView summary = (TextView)convertView.findViewById(R.id.questionHl);
final TextView asker = (TextView)convertView.findViewById(R.id.asker);
TextView numviews = (TextView)convertView.findViewById(R.id.numViews);
TextView numAnswers = (TextView)convertView.findViewById(R.id.numAnswers);
final TextView fullText = (TextView)convertView.findViewById(R.id.fullText);
summary.setText(q.get(position).summary);
asker.setText("by " + q.get(position).author);
numviews.setText(Integer.toString(q.get(position).views));
numAnswers.setText(Integer.toString(q.get(position).numAnswers));
fullText.setText(q.get(position).fullText);
convertView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if (fullText.getVisibility() == 8){
fullText.setVisibility(1);;
}
else if (fullText.getVisibility() == 0){
fullText.setVisibility(8);
}
}
});
return convertView;
}
你的意思是子視圖不會擴大? – psykhi
正確的 - 這主要表現就好像它是一個普通的ListView,孩子的觀點不會出現 – drewmoore