实现 点击 时 有按压效果 更换颜色

<ImageButton
android:id="@+id/mediacontroller_Fullscreen_or_not"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:contentDescription="@string/mediacontroller_Fullscreen_or_not"
android:background="@drawable/mediacontroller_fullscreen_selector"
android:src="@drawable/mediacontroller_fullscreen" />

mediacontroller_fullscreen_selector.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@color/mediacontroller_bg_pressed" android:state_focused="true"/>
<item android:drawable="@color/mediacontroller_bg_pressed" android:state_pressed="true"/>
<item android:drawable="@color/transparent" android:state_enabled="false"/>
<item android:drawable="@color/transparent"/>

</selector>

colors.xml

<?xml version="1.0" encoding="UTF-8"?>
<resources>

<color name="transparent">#00000000</color>
<color name="mediacontroller_bg_pressed">#ff53c1bd</color>
<color name="mediacontroller_bg">#99000000</color>

</resources>

imagebutton 设置点击和按压效果的更多相关文章

  1. zoom动画,实现图片点击预览效果

    参考:https://developer.android.google.cn/training/animation/zoom.html 1.创建Views 下面的布局包括了你想要zoom的大版本和小版 ...

  2. ImageButton按压效果失效

    LinearLayout中ImageButton的按压效果不起作用,如图 布局如下: <LinearLayout android:id="@id/ll_add_reply_face&q ...

  3. ImageView设置点击效果没有用?ImageView src的图片大小改变不了?

    ImageView设置点击效果没有用? 解决 1.ImageView xml里面必须clickable 和longClickable为true <ImageView android:layout ...

  4. Android Studio 之 Button(圆角,描边,按压效果)

    •普通Button <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns: ...

  5. 给EditText的drawableRight属性的图片设置点击事件 分类: 学习笔记 android 2015-07-06 13:20 134人阅读 评论(0) 收藏

    这个方法是通用的,不仅仅适用于EditText,也适用于TextView.AutoCompleteTextView等控件. Google官方API并没有给出一个直接的方法用来设置右边图片的点击事件,所 ...

  6. Button的几种常用的xml背景,扁平化,下划线,边框包裹,以及按压效果

    Button的几种常用的xml背景,扁平化,下划线,边框包裹,以及按压效果 分享下我项目中用到的几种Button的效果,说实话,还真挺好看的 一.标准圆角 效果是这样的 他的实现很简单,我们只需要两个 ...

  7. 给EditText的drawableRight属性的图片设置点击事件

    这个方法是通用的,不仅仅适用于EditText,也适用于TextView.AutoCompleteTextView等控件. Google官方API并没有给出一个直接的方法用来设置右边图片的点击事件,所 ...

  8. Android特效专辑(十)——点击水波纹效果实现,逻辑清晰实现简单

    Android特效专辑(十)--点击水波纹效果实现,逻辑清晰实现简单 这次做的东西呢,和上篇有点类似,就是用比较简单的逻辑思路去实现一些比较好玩的特效,最近也是比较忙,所以博客更新的速度还得看时间去推 ...

  9. 小程序map地图点击makert放大效果和点击放大地图

    WXML文件和JS文件代码在下方 <view class='map'> <map id="map" longitude="{{location.lng} ...

随机推荐

  1. CAD梦想看图6.0安卓版 20181022更新

    下载地址: http://www.mxdraw.com/ndetail_10109.html 1. 保存上次的文件浏览位置和绘制颜色 2. 调整工具条按钮位置和文字 3. 增加测量距离和面积时的捕捉功 ...

  2. MongoDB 启动和关闭

    重启命令 service mongodb restart 启动命令 mongod -f /data/tools/mongodb/config/config.conf 必须要带配置文件才能启动 关闭命令 ...

  3. 【转载】Java下利用Jackson进行JSON解析和序列化

    参考资料: https://blog.csdn.net/sdut406/article/details/85647982 Java下常见的Json类库有Gson.JSON-lib和Jackson等,J ...

  4. [Algorithm] 10. Reverse Integer

    Description Given a 32-bit signed integer, reverse digits of an integer. Example Example 1: Input: 1 ...

  5. UVA-1589 象棋(模拟)

    题目:(传送门) 给出一个象棋的残局,下一步是黑棋走,判断黑棋是不是被将死. 思路: 读完这个题,知道是一个模拟题,然后想到用两个二维数组来模拟棋盘,一个(mp数组)用来存残局,一个(res数组)用来 ...

  6. CentOS7安装Nginx及其相关

    一.安装所需环境 gcc 安装 安装 nginx 需要先将官网下载的源码进行编译,编译依赖 gcc 环境,如果没有 gcc 环境,则需要安装. yum install gcc-c++ PCRE pcr ...

  7. xfce 安装文泉驿字体

    下载文泉驿字体 #拷贝字体到目录/usr/share/fonts/wqy#创建字体缓存 mkfontscale # 在当前目录下生成fonts.scale文件 mkfontdir # 在当前目录下生成 ...

  8. Reading Lists

    * Non-academic 1. Slowing Down to the Speed of Life, by Richard Carlson and Joseph Bailey.2. Your Mo ...

  9. plot3d

    plot3d plot3D a format for structured grid data that was popularized by NASA's CFD visualization Aut ...

  10. 数位dp备忘录

    hdu 4734:把限制值化为数组形式,逐位求解 hdu 4507:类似于上题,其中求平方和的方法很妙 SPOJ  BALNUM Balanced Numbers:经典数位dp,注意两点,1,不要把前 ...