getView功能从来没有所谓 [英] getView function never called
本文介绍了getView功能从来没有所谓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网页视图,但getView函数永远不会被调用。我见过类似的问题,但它的问题,那里有differenr。谁能帮我?
I have a webview but the getView function is never called. I have seen similar question but it the problems there where differenr. Can anyone help me?
Java的code:
Java code:
List<String[]> info=new ArrayList<String[]>();
String[] names_info=new String[5];
String[] phones_info=new String[5];
String[] map_info=new String[5];
String[] web_info=new String[5];
String[] photos_info=new String[5];
for(int i=0;i<names_info.length;i++)
{
info.add(new String[]{names_info[i],phones_info[i],map_info[i],web_info[i],photos_info[i]});
}
for (int i = 0; i < info.size(); i++) {
Log.d("TAG", "item " + i +
" name:" + info.get(i)[0] +
" info:" + info.get(i)[1]);
}
FacilitiesAdapter adapter = new FacilitiesAdapter(this,info,want_info_display,want_phone_display,want_photos_display);
//System.out.println(info[0]);
setListAdapter(adapter);
我看到日志的结果,这样就意味着我的信息通常是得到它的结果。
I see results in Log, so that means that my info is getting its result normally.
这是我的适配器。
public class FacilitiesAdapter extends ArrayAdapter<String> {
private final Context context;
List <String[]> dataList;
public FacilitiesAdapter(Context context, List<String[]> dataList, int need_phone, int need_info, int need_photos) {
super(context, R.layout.expand_row);
this.context = context;
this.dataList = dataList;
//this.tracks_condition=tracks_condition;
//this.count=count;
}
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.expand_row, parent, false);
System.out.println("I am here");
String[] data = dataList.get(position);
String name=data[0];
TextView textView = (TextView) rowView.findViewById(R.id.name);
System.out.println("I am in the adapter "+name);
textView.setText(name);
return rowView;
}
}
在这里我不甚至可以看到 *的System.out.println(我在这里); *
。
任何帮助吗?
here I dont even see *System.out.println("I am here");*
.
any help?
推荐答案
改变超(背景下,R.layout.expand_row);
与超(背景下,R.layout.expand_row,DataList控件);
或ovveride的getViewCount回调,让它回到你要显示的项目数
or ovveride the getViewCount callback and let it return the number of item you want to show
这篇关于getView功能从来没有所谓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文