<!-- 按钮设置按下去的不同效果的方式,设置android:background属性,
下面的 button_select实际上是button_select.xml --> <Button
android:id="@+id/btn_contentprovider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_select"
android:text="无图的联系人" >
</Button>

button_select.xml :

 <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 本xml名:button_select.xml, 设置按钮按下去的效果,实际上就是不同的图片 -->
<item android:drawable="@drawable/btn_normal" android:state_pressed="false"></item>
<item android:drawable="@drawable/btn_pressed" android:state_pressed="true"></item> </selector>

btn_normal.png:

btn_pressed.png

android设置按钮按下的不同效果图的更多相关文章

  1. UI设计篇·入门篇·绘制简单自定义矩形图/设置按钮按下弹起颜色变化/设置图形旋转

    Android的基本控件和图形有限,难以满足所有的实际需要和设计需求,好在Android给出了相对完善的图形绘制和自定义控件的API,利用这些API,可以基本满足设计的需求. 自定义图像和控件的方法: ...

  2. Android设置按钮为透明

    设置一个按钮为透明, (1)修改配置文件 <Button android:id="@+id/btnAppMore"     android:layout_width=&quo ...

  3. Android 设置按钮为透明

    设置一个按钮为透明, (1)修改配置文件 <Button android:id="@+id/btnAppMore" android:layout_width="wr ...

  4. Android 设置按钮背景透明与半透明_图片背景透明

    Button或者ImageButton的背景设为透明或者半透明 半透明<Button android:background="#e0000000" ... />  透明 ...

  5. Android设置按钮透明

    <Button android:id="@+id/bt3" android:layout_width="163dp" android:layout_hei ...

  6. android imageview按钮按下动画效果

    private ImageView today_eat: today_eat = (ImageView) view.findViewById(R.id.today_eat); today_eat.se ...

  7. Android selector item 属性大全(按钮按下不同效果)

    <selector>         必须.必须是根元素.包含一个或多个<item>元素.          Attributes:             xmlns:and ...

  8. android 控件: xml 设置 Button 按下背景

    本篇文章讲述了不使用java代码来改变 Button 按下和未按下时的背景. 首先准备两张图片, 分别是按钮按下和按钮未按下的. 在res/drawable 文件夹中创建一个button_select ...

  9. iOS小技巧 - 为按钮设置不同状态下的背景色

    我们知道直接在Storyboard中设置按钮的背景色是不能根据不同状态来更改的,那问题来了,如果我们需要在不同的状态下(比如按钮没有被按下或者被按下),使得按钮呈现不同的背景色怎么办? 比如上图左边是 ...

随机推荐

  1. Qt限制文本框输入的方法(使用QRegExpValidator,为QLineEdit所独有)

    在做界面编程的时候,对文本框的处理往往是个很头疼的事情,一是焦点进入文本框时,从人性化考虑,应选择文本框中文本,方便输入:二是,限制文本框的输入,只允许输入有效的文本,如果不这样做的话,那么就需要在程 ...

  2. css 自适应布局阮一峰

    转载一篇文章: 自适应网页设计(Responsive Web Design) 作者: 阮一峰 移动设备正超过桌面设备,成为访问互联网的最常见终端.于是,网页设计师不得不面对一个难题:如何才能在不同大小 ...

  3. BZOJ 2253: [2010 Beijing wc]纸箱堆叠

    题目 2253: [2010 Beijing wc]纸箱堆叠 Time Limit: 30 Sec  Memory Limit: 256 MBSubmit: 239  Solved: 94 Descr ...

  4. 有关Gcd,Lcm的一点小结论

    先介绍两个: 大数的Gcd Stein+欧几里德 function stein(a,b:int64):int64; begin if a<b then exit(stein(b,a)); the ...

  5. VIPS:基于视觉的页面分割算法[微软下一代搜索引擎核心分页算法]

    VIPS:基于视觉的页面分割算法[微软下一代搜索引擎核心分页算法] - tingya的专栏 - 博客频道 - CSDN.NET VIPS:基于视觉的页面分割算法[微软下一代搜索引擎核心分页算法] 分类 ...

  6. tlplayer for ios V1.0

    此程序UI修改于虎跃在线课堂.所以极其相似. 可以播放网络视频与本地视频,不知道怎么拷贝本地视频到Ipad或iphone上看的朋友,请自己到网上看教程. 支持mms,file,rtsp,rtmp,ht ...

  7. Error (0xc0000225) installing Windows 8 R2 on VirtualBox

    Windows Boot Manager Windows failed to start. A recent hardware or software change might be the caus ...

  8. LOJ 1370 Bi-shoe and Phi-shoe(欧拉函数的简单应用)

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1370 题意:给你n个整数,第i个整数为Xi.定义phi(k)为k的欧拉函数值,设pi为 ...

  9. Maven Spring JUnit 在Maven Clean Install时报

    问题: Maven Clean Install时, 遇到报错package org.junit does not exist 明显, Unit Test在Compile阶段就被检查了. 而POM.xm ...

  10. pprint模块解析

    pprint模块提供了打印任意python数据结构的方法,如果这个数据结构不是python的基本类型,则可能无法打印结果.         pprint模块定义了一个类:         pprint ...