关于gridview中第一个button点击不消失的问题
gridview的第一个button点击不消失,如何解决呢?
gridview的第一个button点击不消失,如何解决呢?
2016-11-09
老师早就解决了,把MyGridView里面的getView方法改为
public View getView(int position, View convertView, ViewGroup parent) { final WordButton holder; if (convertView==null){ convertView = Util.getView(mContext, R.layout.self_ui_gridview_item); holder = mArrayList.get(position); //加载动画 mScaleAnimation = AnimationUtils.loadAnimation(mContext, R.anim.scale); //设置动画延迟时间 mScaleAnimation.setStartOffset(position*100); holder.mIndex = position; if (holder.mViewButton == null) { holder.mViewButton = (Button)convertView.findViewById(R.id.item_btn); holder.mViewButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 回调 mWordButtonClickListener.onWordButtononClick(holder); } }); } convertView.setTag(holder); }else { holder = (WordButton) convertView.getTag(); } holder.mViewButton.setText(holder.mWordString); //播放动画 convertView.startAnimation(mScaleAnimation); return convertView; }
就好了
举报