HomeActivity2

private void showBestGallery(View paramChildView, String paramFunctionId, boolean paramBoolean){
  final View childview = paramChildView;
  
  
  final HashMap<Integer, String> goodsname = new HashMap<Integer, String>();
  goodsname.put(0, "商品名称0");
  goodsname.put(1, "商品名称1");
  goodsname.put(2, "商品名称2");
  goodsname.put(3, "商品名称3");
  goodsname.put(4, "商品名称4");
  goodsname.put(5, "商品名称5");
  
  final HashMap<Integer, String> goodsprice = new HashMap<Integer, String>();
  goodsprice.put(0, "30.00");
  goodsprice.put(1, "31.00");
  goodsprice.put(2, "32.00");
  goodsprice.put(3, "33.00");
  goodsprice.put(4, "34.00");
  goodsprice.put(5, "35.00");
  
  //获取Gallery对象
  gallery_best = (Gallery)paramChildView.findViewById(R.id.home_best_gallery);
  //添加ImageAdapter给Gallery对象
  final BestGalleryAdapter gallery_adapter = new BestGalleryAdapter(paramChildView.getContext());
  
  gallery_best.setAdapter(gallery_adapter);
  
  //gallery_best.setGravity();
  //gallery_best.set
  gallery_best.setCallbackDuringFling(false);
  gallery_best.setSelection(Integer.MAX_VALUE/2); //设置初始化显示中间的图片,形成左右都可循环的效果
  gallery_best.setOnItemSelectedListener(new OnItemSelectedListener(){

   public void onItemSelected(AdapterView<?> arg0, View arg1,
     int arg2, long arg3) {
    // TODO Auto-generated method stub
    TextView goods_name = (TextView)childview.findViewById(R.id.home_best_goods_item_name);
    goods_name.setText(goodsname.get(arg2%goodsname.size()));
    
    TextView goods_price = (TextView)childview.findViewById(R.id.goods_Price);
    goods_price.setText(goodsprice.get(arg2%goodsprice.size()));
    
    gallery_adapter.setSelectItem(arg2);
   }

   public void onNothingSelected(AdapterView<?> arg0) {
    // TODO Auto-generated method stub
   }
   
  });

  m_bestgoods_expansionview.expand();
 }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值