網路城邦
上一篇 回創作列表 下一篇  字體:
ListView
2017/03/24 18:09:08瀏覽43|回應0|推薦0
ListView 


String[] str_ary1;

ArrayAdapter str_ary_adpt1r = new ArrayAdapter (this,

simple_list_item_1,

str_ary1);



ListView lv1 = ()getViewById();

lv1.setAdapter(str_ary_adpt1);


//-----

ArrayAdapter str_ary_adpt1r = new ArrayAdapter (this, simple_list_item_1);

str_ary_adpt1r.add("string1");

str_ary_adpt1r.add("string2");

//-----

lv1.setOnItemClickListener(new OnItemClickListener(){

@Override

public void onItemClick(AdapterView arg0, View arg1, int arg2,

long arg3) {

// TODO Auto-generated method stub

ListView lv2 = (ListView)arg0;

Log.i("greatcat",Integer.toString(arg2)+" "+lv2.getItemIdAtPosition(arg2));

}

});
( 心情隨筆心情日記 )
回應 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=greatcat&aid=98642036