com.example.listview; android.support.v7.app.AppCompatActivity; android.os.Bundle; android.widget.ArrayAdapter; android.widget.ListView; android.widget.SimpleAdapter; java.util.ArrayList; java.util.HashMap; java.util.List; java.util.Map; java.util.Objects; MainActivity AppCompatActivity { ListView ; ArrayAdapter<String>; SimpleAdapter ; List<Map<String,Object>>; onCreate(Bundle savedInstanceState) { .onCreate(savedInstanceState); setContentView(R.layout.); =(ListView)findViewById(R.id.);=ArrayList<Map<String,Object>>(); =SimpleAdapter(,getData(),R.layout.,String[]{,},[]{R.id.,R.id.}); .setAdapter(); } List<Map<String,Object>> getData(){ (i=;i<;i++){ Map<String,Object>map=HashMap<String,Object>(); map.put(,R.mipmap.); map.put(,+i); .add(map); } ; } }
这里有个提示就是:
不知道这是为啥啊,求大神帮忙解决下!谢谢!
慕仰6620973
相关分类