I know that this question have been asked before and i have gone through them but they didnt solve my problem.
I have ScrollView with one LinearLayout with imageview. And i have used ontouchListner to imageview to give them click effect like this
switch (motionEvent.getAction()) { case MotionEvent.ACTION_DOWN: view.getBackground().setColorFilter(0xCCCDDC39, PorterDuff.Mode.SRC_ATOP); view.invalidate(); break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: view.getBackground().clearColorFilter(); view.invalidate(); startActivity(view.getId()); break; } But the problem is whenever i scroll ontouchlistner is called of imageview and image gets clicked .I dont want this whenever i am scrolling , Because this does not allow me to scroll. Please help
onClickListenerinstead of touch listener to handle click events &selectorto change the color of the view on click.selectoralso? You can dynamically set two images for the pressed and normal state programmatically. Refer this: stackoverflow.com/questions/12754067/…