點擊列表項時,我有一點功能可以敲出列表視圖並且不會觸發列表視圖。我的代碼在這裏:列表視圖ListItem中的Strike out和unstrikeout
public void markComplete(View v)
{
Button b1 = (Button)findViewById(R.id.Completeit);
Button b2 = (Button)findViewById(R.id.InCompleted);
try{
TextView tv = (TextView)findViewById(R.id.textViewx);
tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
}catch(Exception e){e.printStackTrace();}
b1.setVisibility(-1);
b2.setVisibility(1);
}
public void markInComplete(View v)
{
Button b1 = (Button)findViewById(R.id.Completeit);
Button b2 = (Button)findViewById(R.id.InCompleted);
try{
TextView tv = (TextView)findViewById(R.id.textViewx);
tv.setPaintFlags(tv.getPaintFlags() & (~ Paint.STRIKE_THRU_TEXT_FLAG));
}catch(Exception e){e.printStackTrace();}
b1.setVisibility(1);
b2.setVisibility(-1);
}
我有兩個按鈕用於檢查和取消選中列表項。它僅適用於第一個列表項。如果我嘗試點擊第二個列表項目,則僅在第一個項目上完成醒目的&無劃痕。任何幫助表示感謝,並提前致謝
是每個listview行中的這些按鈕嗎? – blessenm