MyAdapter adapter;//。。。
spinner.setAdapter(adapter);/*不是很清楚这个方法的作用,但是看起来好像是设置下拉选项的样子*/
public class MyAdapter extends Adapter{
private Context context;
private List<String> list;
private LayoutInflater inflater;
//构造函数
public MyAdapter(Context context,List<String> list){
super();
this.context = context;
this.list = list;
this.inflater = LayoutInflater.from(context);
}
/*分别实现public int getCount(),public Object getItem,public long getItemId(int position),public View getView(int position, View convertView, ViewGroup parent)这些方法*/
}
//定义一个函数来设置list的元素
public List inputData(){
List<String> list = new ArrayList();
for (int i = 0; i < 5; i++) {
list.add(i+"");
}
return list;
}
懒癌又发作了,今天就打这些上去吧,仅表示今天有在学习