Android控件点击效果

Android中Button控件是有点击效果的,但是像TextView、ImageView、各种Layout是没有点击效果的,给TextView设置点击事件后,加个点击效果用户触控反馈会好一点;

最简单的默认点击效果:

android:background="?android:attr/selectableItemBackground"

如果该空间已经有背景色了,可以设置前景色

android:foreground="?android:attr/selectableItemBackground"

这样一个Android原生的涟漪效果就出来了;

注意:

?android:attr/selectableItemBackgroundBorderless  ?android:attr/selectableItemBackground  

前景色:foreground属性只能给控件和帧布局设置,其它的布局设置无效果,具体看Android源码;

也可自定义,按照你的需求来:

<?xml version="1.0" encoding="utf-8"?>                        

 

转载于:https://www.cnblogs.com/cuichen16/p/10785926.html

更多相关文章

  1. Android—Service详解—模拟点击抽奖(2020.7.3)
  2. android:configChanges 问题
  3. 【Android】TextView 属性详解
  4. ionic3中android状态栏
  5. [置顶] EditText属性大全
  6. 【Android(安卓)界面效果42】如何自定义字体
  7. android listview 自定义分割线总结
  8. EditText禁止输入中文设置
  9. Android(安卓)Styles and Themes

随机推荐

  1. Android(安卓)MTP模式切换分析
  2. Android(安卓)实现屏幕底部弹出Dialog
  3. AS多渠道打包
  4. Android(安卓)Studio中的Module打包成jar
  5. android 随笔记录1
  6. libdgx使用初步
  7. Android(安卓)下拉搜索提示框的实现
  8. android 跨进程访问service方法
  9. 自定义布局RelativeLayout 画网格线
  10. Android自定义VIEW取得XML的自定义值