手指对控件的按下,放了,背景颜色改变的监听事件

来源:互联网 发布:淘宝销量统计软件 编辑:程序博客网 时间:2024/04/28 00:10
holder.tv.setOnTouchListener(new View.OnTouchListener() {    @Override    public boolean onTouch(View view, MotionEvent motionEvent) {状态        if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){   //判断手指的            holder.linearLayout.setBackgroundColor(Color.rgb(220,220,220));        }        else if(motionEvent.getAction() == MotionEvent.ACTION_MOVE){            holder.linearLayout.setBackgroundColor(Color.WHITE);        }else if(motionEvent.getAction() == MotionEvent.ACTION_UP){            holder.linearLayout.setBackgroundColor(Color.WHITE);        }        return false;    }});
原创粉丝点击