这里是使用setOnTouchListener模拟Listview类似效果
final FrameLayout aboutLayout = (FrameLayout) findViewById(R.id.about_layout);
aboutLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
aboutLayout.setBackgroundColor(getResources().getColor(R.color.backgroundDark));
} else if (event.getAction() == MotionEvent.ACTION_UP) {
aboutLayout.setBackgroundColor(getResources().getColor(R.color.backgroundLight));
Intent i = new Intent(SettingsActivity.this, AboutActivity.class);
startActivity(i);
}
return true;
}
});