Gridview的點選事件和每個item中控件的事件需要設定下事件優先級
,不然會造成事件沖突。
隻需在item布局的根布局中加上android:descendantFocusability=”blocksDescendants”即可解決。
注:(用第三個即可)
屬性的值有三種:
beforeDescendants:viewgroup會優先其子類控件而擷取到焦點
afterDescendants:viewgroup隻有當其子類控件不需要擷取焦點時才擷取焦點
blocksDescendants:viewgroup會覆寫子類控件而直接獲得焦點