<ImageButton android:id="@+id/imgBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/nopress" /> final ImageButton imgBtn = (ImageButton) findViewById(R.id.imgBtn); imgBtn.setOnTouchListener(new OnTouchListener() { //OnTouchListener 触屏监听器 public boolean onTouch(View arg0, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN){ imgBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.press)); //getResources().getDrawable(id) 传入图片ID得到一个Drawable对象 }else if(event.getAction() == MotionEvent.ACTION_UP){ imgBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.nopress)); } return false; } });