There is a standard button:
<Button android:id="@+id/button_1" android:layout_width="match_parent" android:layout_height="wrap_content" android:alpha="1" android:text="Button"/> When you hold the button, it programmatically changes the color. When squeezing should return to the original color:
@Override public boolean onTouch(View v, MotionEvent event) { Button button1 = (Button) findViewById(R.id.button_1); if (event.getAction() == MotionEvent.ACTION_DOWN ){ button1.getBackground().setColorFilter(Color.parseColor("#00FF00"), PorterDuff.Mode.DARKEN); return true; } else if (event.getAction() == MotionEvent.ACTION_UP) { button1.getBackground().setColorFilter(Color.parseColor("Как определить первоначальный цвет?"), PorterDuff.Mode.DARKEN); return true; } return false; } Where to see the default button color?
StateList(xml<selector>) , which allows a minimum of code (creating one xml file) to specify actions for clicks, selections and other actions on widgets, why write your crutch. - pavlofff