Android之ImageButton控件基础操作
控件绑定(前台对应控件的id属性要设置为imageButton_light)
private ImageButton imageButton_light;//定义一个ImageButton控件对象,名为imageButton_light
imageButton_light = (ImageButton) this.findViewById(R.id.imageButton_light);//与前台名为imageButton的控件进行控件绑定
设置点击监听器(前台对应控件的onClick属性要设置为onClick)
imageButton_light.setOnClickListener(this);
控件点击操作(前台对应控件的onClick属性要设置为onClick)
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.imageButton_light:{
//do sth
break;
}
}
}
更改控件背景图片
imageButton_sos.setBackgroundResource(R.drawable.pic2);//假设默认图片为pic,在此更改为pic2
设置控件Alpha值
imageButton_light.getBackground().setAlpha(50);
设置控件可用性
imageButton_light.setEnabled(false);
Android之ImageButton控件基础操作的更多相关文章
- Python——控件基础操作
一.生成主窗口(主窗口操作) window=tkinter.Tk() #修改框体的名字,也可在创建时使用className参数来命名: window.title('标题名') #框体大小可调性,分别表 ...
- Android Studio 之 控件基础知识
1. TextView 和 EditText 控件常用属性 android:layout_width="match_parent" 宽度与父控件一样宽 android:layou ...
- Android自定控件基础(一)——几何图形绘制
虽然本人有几年开发经验,但是自定义控件这一块儿,研究的很少,惭愧--用到的时候就是百度查找,复制粘贴.工时紧,总是想的快点完工就好.(都是借口啦,想学总会有时间哒) 作为一个Android开发 要说自 ...
- Android 中常见控件的介绍和使用
1 TextView文本框 1.1 TextView类的结构 TextView 是用于显示字符串的组件,对于用户来说就是屏幕中一块用于显示文本的区域.TextView类的层次关系如下: java.la ...
- 【ALearning】第三章 Android基本常见控件
本章主要介绍主要的寻常较多使用的控件,包含TextView.EditView.ImageView.Button等.本章将介绍相关控件基本属性的使用,为以后章节的进阶学习提供基础.案例中引用的Linea ...
- 【风马一族_Android】第4章Android常用基本控件
第4章Android常用基本控件 控件是Android用户界面中的一个个组成元素,在介绍它们之前,读者必须了解所有控件的父类View(视图),它好比一个盛放控件的容器. 4.1View类概述 对于一个 ...
- Android笔记---常用控件以及用法
这篇文章主要记录下Android的常用控件以及使用的方法,Android 给我们提供了大量的UI控件,合理地使用这些控件就可以非常轻松地编写出相当不错的界面,这些是Android学习的基础,没有什么业 ...
- Android其它新控件 (转)
原文出处:http://blog.csdn.net/lavor_zl/article/details/51312715 Android其它新控件是指非Android大版本更新时提出的新控件,也非谷歌I ...
- 【转】Android M新控件之AppBarLayout,NavigationView,CoordinatorLayout,CollapsingToolbarLayout的使用
Android M新控件之AppBarLayout,NavigationView,CoordinatorLayout,CollapsingToolbarLayout的使用 分类: Android UI ...
随机推荐
- javaWeb中的JDBC学习入门
学习引荐地址:https://www.cnblogs.com/xdp-gacl/p/3946207.html 一.JDBC的相关概念介绍 1.1 数据库驱动 其实就好比我们平时使用到的独立声卡.网卡之 ...
- GIT使用(自用)
1.远程分支就是本地分支push到服务器上的时候产生的.比如master就是一个最典型的远程分支(默认). 1 $: git push origin master 除了master之外,我们还可以随便 ...
- <摘录>GCC 中文手
GCC 中文手册 作者:徐明 GCC Section: GNU Tools (1) Updated: 2003/12/05 Index Return to Main Contents -------- ...
- 让SignalR客户端回调支持强类型
几天写一个小程序的时候用到了SignalR,发现现在SingalR Server 支持强类型了,也就是说,我们可以定义一个客户端的通知契约: public interface IClient { ...
- cas协议,以及tomcat搭建cas服务器
1. CAS 简介 1.1. What is CAS ? CAS ( Central Authentication Service ) 是 Yale 大学发起的一个企业级的.开源的项目,旨 ...
- easyui datagrid 表格动态隐藏部分列的展示
1.一套代码中,可能不同的项目情况都在用,但是可能不同的项目要求展示的datagrid列的内容并不一致,所以能够动态的显示部分datagrid列的内容. 即datagrid的中的某一列,这个项目要求显 ...
- 登录Tomcat控制台
在http://localhost:8080界面中,右上角有三个按纽对应着三个控制台:Server Status控制台,Manager App控制台和Host Manager控制台.Server St ...
- HDU 3726 Graph and Queries treap树
题目来源:HDU 3726 Graph and Queries 题意:见白书 思路:刚学treap 參考白皮书 #include <cstdio> #include <cstring ...
- ini配置文件的读取
.ini 文件是Initialization File的缩写,即初始化文件.是windows的系统配置文件所采用的存储格式,统管windows的各项配置,一般用户就用windows提供的各项图形化管理 ...
- [Functional Programming Moand] Update The State Of A State Monad (put)
Stateful computations require the ability for their state to change overtime. We take a look on one ...