我正在嘗試創建一個ListView,您可以一次點擊不超過4個項目。 這些項目必須彼此相鄰。ListView - 獲取點擊項目的相鄰項目
當我點擊我的第一個項目,我想看看是否先前或以下項目已被點擊。
注:當我單擊一個項目時,我更改背景顏色。所以如果我想告訴一個項目是否被點擊,我只想檢查背景顏色。
public void OnItemClick(AdapterView<?> parent, View, view, int position, long id){
View currentItem = view;
currentItem.setBackgroundResource(R.drawable.li_gradient);
// How do I get the view in front of and behind currentItem
// to check their current background color? (Assuming they exist)
}