作者:
zorpger (亂世浮生)
2016-05-22 23:08:51大家好 我有個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行
謝謝!!