Android学习心得③ - Layout模拟ListView item按下效果
2015-11-25 17:38
633 查看
这里是使用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; } });
相关文章推荐
- Android 图片加载Bitmap OOM错误解决办法
- android学习笔记13 - 单位dip、dp、px、sp的区别
- android tab dialog
- 老李分享:Android性能优化之内存泄漏3
- AndroidImageSlider超炫的轮播图效果
- 老李分享:Android性能优化之内存泄漏2
- Android获取有线网ip地址
- Android自动填写验证码
- 老李分享:Android性能优化之内存泄漏1
- Android常用控件及对应Robotium API
- 安卓开发之注册静态广播
- Android开发者必知的5个开源库
- Android之让图片匀速旋转效果
- 手机上播放视频 Android VideoView
- 【Android】设置EditText为仅输入数字且最多只能有两位数字
- Android 首次开机优化
- Android应用性能剖析全攻略
- MTK安卓sim卡相关源码分析
- Android 属性动画备忘 nineold
- Android——AndroidStudio字体大小设置(Log日志区域)