我正在尝试使用以下代码在listview中添加元素:
HashMap<String, Object> _item = new HashMap<>();
_item.put("converttype", result.getText().toString());
list.add(_item);
public View getView(final int _position, View _view, ViewGroup _viewGroup) {
LayoutInflater _inflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View _v = _view;
if (_v == null) {
_v = _inflater.inflate(R.layout.listview, null);
}
final TextView converttype = (TextView) _v.findViewById(R.id.converttype);
converttype.setText(list.get((int)_position).get("converttype").toString());
return _v
}
它应输出:
1.4
但它始终输出:
{converttype = 1.4}