0
我的適配器類是這樣的:的Android的ListView BaseAdapter
public View getView(int i, View view, ViewGroup viewGroup) {
View satirView;
satirView = mInflater.inflate(R.layout.adapter, null);
TextView ad = (TextView) satirView.findViewById(R.id.ad);
TextView soyad = (TextView) satirView.findViewById(R.id.soyad);
TextView tarih = (TextView) satirView.findViewById(R.id.tarih);
Button buton = (Button) satirView.findViewById(R.id.icon);
police po = policem.get(i);
ad.setText(po.getAd());
soyad.setText(po.getNo());
tarih.setText(po.getTarih());
return satirView;
}
和我的MainActivity類別是這樣的:
listView = (ListView) findViewById(R.id.list);
// Defined Array values to show in ListView
List<police> values = new ArrayList<police>();
values.add(new police("ss","kk","123"));
values.add(new police("ss","kk","456"));
values.add(new police("ss","kk","789"));
values.add(new police("ss","kk","147"));
values.add(new police("ss","kk","258"));
values.add(new police("ss","kk","753"));
adabter adapt = new adabter(this,values);
listView.setAdapter(adapt);
我有按鈕,但我不能使用onclickedlistener梅託德..我應該怎麼辦? 我在哪裏寫作?
如果你想設置的點擊監聽器?在整個列表項目上還是隻在您的視圖中的按鈕? –