尝试在写好的ViewPager中添加listView出错
直接使用FindViewById报空指针,使用Inflater来FindViewById获取到ListView但是绑定适配器失败。
public void initGoodList(){ data=new ArrayList<Map<String,Object>>(); // LayoutInflater inflater = getLayoutInflater(); // View shopList=inflater.inflate(R.layout.shop, null); listView=(ListView) findViewById(R.id.shopList); //listView=(ListView) shopList.findViewById(R.id.shopList); //listView=(ListView) findViewById(R.id.shopList); //Toast.makeText(this, ""+listView, Toast.LENGTH_LONG).show(); //Log.i("listview", "MyListView"+listView); sim_Adapter=new SimpleAdapter(this, getData(), R.layout.goods_item, new String[]{"goodImg","goodInfo"},new int[]{R.id.goodImg,R.id.goodInfo}); listView.setAdapter(sim_Adapter); }