为了账号安全,请及时绑定邮箱和手机立即绑定

尝试在写好的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);
			
		}


正在回答

举报

0/150
提交
取消
多种多样的App主界面Tab实现方法
  • 参与学习       48915    人
  • 解答问题       204    个

本课程就将讲解迄今为止最流行的4种实现Tab的方法

进入课程

尝试在写好的ViewPager中添加listView出错

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号