看板 AndroidDev 關於我們 聯絡資訊
請問若我畫面有兩個ListView,在個別的ListView最下面都有添加footerview,且 footerview都有設監聽(setOnClickListener)可以onClick,目前遇到問題是當我按下 footerview時,要判端斷按下的是哪一個footerview要如何判斷?? 畫面類似下圖的兩邊最下方新增 http://i.imgur.com/DRFl8yS.jpg 兩個footerview的寫法如下: View footerView = ((LayoutInflater)this. getSystemService(Context.LAYOUT_INFLATER_SERVICE)). inflate(R.layout.footerview, null, false); View footerView2 = ((LayoutInflater)this. getSystemService(Context.LAYOUT_INFLATER_SERVICE)). inflate(R.layout.footerview2, null, false); public void onClick(View v) { if ( ) } if判斷式裡要怎麼寫才能分辨是按下哪個footerview?若還需要麼資訊我可以提供,謝謝 ※ 編輯: apout (49.217.152.115), 06/23/2016 16:09:29
corrupt003: 實做不同的listener 06/23 16:56
謝謝各位,目前使用次方式可以成功
corrupt003: view 加tag去判斷也可以06/23 16:57
加tag去判斷是什麼意思?可以大概說明一下嗎?
ptthao: footView.setOnClickListener(new View.OnClickListener()06/23 19:22
ptthao: {...});06/23 19:22
ptthao: 用手機打的我也不是很確定是不是這樣XD06/23 19:22
x51811danny: view.setTag06/24 00:32
y3k: ==06/24 01:41
※ 編輯: apout (101.12.145.168), 06/24/2016 07:12:28 ※ 編輯: apout (101.12.145.168), 06/24/2016 09:04:31