imageview和imagebutton
来源:互联网 发布:淘宝联盟转链工具 编辑:程序博客网 时间:2024/05/19 11:45
imageview是用来显示图片的控件
src指定当前imageview中的填充内容,地址
background:指定当前控件的背景
1、创建imageview控件
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/ic_launcher"
android:background="#ff0000"
android:id="@+id/image"
android:scaleType="matrix"/>
2、初始化控件并且找到对应id
private ImageView image;
3、创建image对象,添加点击事件
image=(ImageView) findViewById(R.id.image);
image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(edittext.this, "点击了", Toast.LENGTH_LONG).show();
}
});
注意:scaleType是图片显示在imageview中的位置:
结果:
如果有小伙伴觉得我写的对的,请顶一下这篇博文。
阅读全文
1 0
- ImageView和ImageButton
- ImageButton和ImageView
- ImageView和ImageButton
- imageview和imagebutton
- ImageView和ImageButton和Button
- Android中ImageView和ImageButton
- UI控件--ImageView和ImageButton
- ImageButton和ImageView的使用
- ImageView和ImageButton的区别
- Android中的ImageView和ImageButton
- android:ImageView 和ImageButton的区别
- 图像按钮ImageButton和图像ImageView
- android组件ImageView和ImageButton无法正常使用
- 从零开始学android<ImageView和ImageButton的使用.十.>
- Android学习笔记十:基本视图组件:ImageView和ImageButton
- Android UI设计——ImageView和ImageButton控件
- Android UI 设计——ImageView 和 ImageButton 控件
- Android中ImageView和ImageButton的比较详解
- css之边框
- vue2.0之Vuex使用实例
- 最大子序列和
- html之div和span
- JavaScript DOM扩展
- imageview和imagebutton
- HDU 6144 Arithmetic of Bomb(字符串+大数取余模板)
- 元标签
- java 判断字符串编码类型
- tomcat请求处理分析(一) 启动container实例
- Binder听课记录
- 【OpenGL】着色器 Shader
- css之表格
- python3编码问题(网络流数据写入到本地出错问题)