android开发中的自定义适配器 5
publicclassCustomAdapterextendsBaseAdapter{Contextcontext;List<Detail>list;LayoutInfl...
public class CustomAdapter extends BaseAdapter {
Context context;
List<Detail> list;
LayoutInflater inflater;
public CustomAdapter(Context context,List<Detail> list) {
this.context=context;
this.list=list;
inflater=LayoutInflater.from(context);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return list.size();
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return list.get(arg0);
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
arg1=inflater.inflate(R.layout.list_style, null);
TextView textView=(TextView)arg1.findViewById(R.id.name);
TextView textView2=(TextView)arg1.findViewById(R.id.signature);
textView.setText(list.get(arg0).getName());
textView2.setText(list.get(arg0).getSignature());
return arg1;
}
}
请问为什么会出错? 展开
Context context;
List<Detail> list;
LayoutInflater inflater;
public CustomAdapter(Context context,List<Detail> list) {
this.context=context;
this.list=list;
inflater=LayoutInflater.from(context);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return list.size();
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return list.get(arg0);
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
arg1=inflater.inflate(R.layout.list_style, null);
TextView textView=(TextView)arg1.findViewById(R.id.name);
TextView textView2=(TextView)arg1.findViewById(R.id.signature);
textView.setText(list.get(arg0).getName());
textView2.setText(list.get(arg0).getSignature());
return arg1;
}
}
请问为什么会出错? 展开
2个回答
浙江启扬智能科技有限公司
2023-06-12 广告
2023-06-12 广告
ARM,Android,Linux之间并无直接联系。ARM是嵌入式CPU,Andrioid和Linux是操作系统。 ARM不是为Linux而设计,Linux也不是为ARM而设计,二者是独立存在的。Linux和Android可以移植到以ARM...
点击进入详情页
本回答由浙江启扬智能科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询