[問題] Spinner的問題
大家好 我有個Spinner的問題想要問一下
Spinner 要加選項的話要用this.xxx.add("");去加選項
我現在有個問題
假如 get1=a , get2=b ,get3=c , get4=d , get5=e
就會是以下的寫法
this.data = new ArrayList<CharSequence>();
this.data.add(get1());
this.data.add(get2());
this.data.add(get3());
this.data.add(get4());
this.data.add(get5());
this.spdata = (Spinner) super.findViewById(R.id.data);
this.adapterdata = ArrayAdapter <CharSequence>(this,
android.R.layout.simple_spinner_item, this.data);
this.adapterdata.setDropDownViewResource(
android.R.layout.simple_spnner_dropdown_item);
我想問的是有沒有辦法能夠簡化this.data.add這邊
假如有get100 , 不就要add100行
謝謝!!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.240.49.31
※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1463929734.A.D21.html
推
05/22 23:20, , 1F
05/22 23:20, 1F
→
05/23 00:06, , 2F
05/23 00:06, 2F
推
05/23 10:24, , 3F
05/23 10:24, 3F
→
05/23 10:25, , 4F
05/23 10:25, 4F
→
05/23 10:26, , 5F
05/23 10:26, 5F
→
05/23 18:15, , 6F
05/23 18:15, 6F