我试图让我的列表视图只有一行,只有 imageview。这是我的适配器:
public class ListAdapter extends BaseAdapter {
private Context activity;
private ArrayList<HashMap<String, String>> data;
private static LayoutInflater inflater=null;
public ListAdapter(Context a, ArrayList<HashMap<String, String>> d) {
activity = a;
data=d;
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public int getCount() {
return data.size();
}
public Object getItem(int position) {
return data.get(position);
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
View vi=convertView;
if(convertView==null)
vi = inflater.inflate(R.layout.listview, null);
TextView subject = (TextView)vi.findViewById(R.id.subject);
TextView added = (TextView)vi.findViewById(R.id.added);
TextView permalink = (TextView)vi.findViewById(R.id.permalink);
HashMap<String, String> map = new HashMap<String, String>();
map = data.get(position);
//Setting all values in listview
subject.setText(map.get(ViewPagerAdapter.KEY_NEWS_SUBJECT));
added.setText(map.get(ViewPagerAdapter.KEY_NEWS_LAPSE));
permalink.setText(map.get(ViewPagerAdapter.KEY_NEWS_PERMA));
return vi;
}
}
当前的布局很少有 textview,但唯一的一行可以说我在 4 号修复它以仅显示 imageview。我该怎么做??