Java tutorial
//package com.java2s; import android.graphics.Color; import android.view.MotionEvent; import android.view.View; public class Main { public static void setViewTouchHightlighted(final View view) { if (view == null) { return; } view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { view.setBackgroundColor(Color.rgb(1, 175, 244)); } else if (event.getAction() == MotionEvent.ACTION_UP) { view.setBackgroundColor(Color.rgb(255, 255, 255)); } return false; } }); } }