@SuppressWarnings("deprecation") @Override public void initWidget() { super.initWidget(); gestureDetector = new GestureDetector(this); // 手势滑动 titleImg.setBackgroundResource(R.drawable.title_splb); foodBtn.setText("食品"); textileBtn.setText("家纺"); washBtn.setText("洗护"); // 分类下的彩色条 gestureDetector = new GestureDetector(this); // 手势滑动 windowsWidth = this.getWindowManager().getDefaultDisplay().getWidth(); int offset = ListUtils.dip2px(aty, 30); btnSelected.getLayoutParams().width = windowsWidth / 3 - offset; listView = (ListView) this.findViewById(R.id.private_order_list); listView.setAdapter(adapter); listView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { Bundle bundle = new Bundle(); bundle.putString("name", list.get(position).getName()); bundle.putString("description", list.get(position).getName()); bundle.putString("address", list.get(position).getName()); bundle.putString("path", list.get(position).getImagePath()); bundle.putString("type", list.get(position).getType()); MemberShoppeActivity.this.showActivity(aty, TypeDetailActivity.class, bundle); } }); }
// 分类底部彩色条移动 private void moveAnimation(final int num) { final int offset = ListUtils.dip2px(aty, 10); TranslateAnimation animation = new TranslateAnimation(0, -(windowsWidth / 3 - offset) * num, 0, 0); animation.setDuration(500); btnSelected.startAnimation(animation); animation.setAnimationListener( new AnimationListener() { @Override public void onAnimationEnd(Animation arg0) { btnSelected.clearAnimation(); btnSelected.setX(btnSelected.getX() - (windowsWidth / 3 - offset) * num); } @Override public void onAnimationRepeat(Animation arg0) {} @Override public void onAnimationStart(Animation arg0) {} }); }