我有一個問題讓我的點擊偵聽器的可擴展列表視圖工作。我是否正確實施?問題設置onChildClickListener爲ExpandableListView
代碼:
elv = getExpandableListView();
// Set up the adapter
mAdapter = new MyExpandableListAdapter();
elv.setAdapter(mAdapter);
elv.setOnChildClickListener(new OnChildClickListener() {
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Toast.makeText(getApplicationContext(), "click", Toast.LENGTH_SHORT);
v.setBackgroundColor(0x000000);
return false;
}
});
你的問題是什麼? –
起初我以爲點擊沒有被識別,但它是。只是背景顏色不會改變。有任何想法嗎? – Cody