0
使用android studio我試圖創建自定義ListView
。該應用程序不會崩潰,但我沒有items
,我試圖在我的ListView
上顯示。當我在這裏運行時,它是一個list
,但在行中沒有任何內容。我也可以滾動它,我可以點擊沒有問題的行。 這裏是我的ListView
在MainActivity
:創建自定義列表視圖
CustomList adapter = new CustomList(this,myRssFeed.getList());
adapter.addAll();
setListAdapter(adapter);
我CustomAdapter
:
public class CustomList extends ArrayAdapter<RSSItem> {
private final Activity context;
private final List<RSSItem> web;
public CustomList(Activity context, List<RSSItem> web) {
super(context, R.layout.list_item, web);
this.context = context;
this.web = web;
}
@Override
public View getView(int position, View view, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View rowView = inflater.inflate(R.layout.list_item, null, true);
TextView txtTitle = (TextView) rowView.findViewById(R.id.item);
txtTitle.setText((CharSequence) getTitle());
return rowView;
}
private RSSItem getTitle() {
return null;
}
非常感謝你,那工程:) – Rick