<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"> <ImageView
android:id="@+id/image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" /> <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="确认"
android:layout_gravity="center"/> </LinearLayout>

package com.example.uiwidgettest2;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.*; public class edittextActivity extends Activity implements View.OnClickListener{ private ImageView iv;
private Button btn; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edittext);
btn = (Button)findViewById(R.id.button);
iv = (ImageView)findViewById(R.id.image_view);
btn.setOnClickListener(this);
} @Override
public void onClick(View v) {
switch (v.getId()){
case R.id.button:
iv.setImageResource(R.drawable.dst);
break;
default:
break;
}
}
}


												

Android控件— — —ImageView的更多相关文章

  1. Android控件——ImageView

     android:orientation="vertical"  修改布局文件垂直排列 放置图片: 1.通过src引入图片: 2.通过background引入背景图片 3.baco ...

  2. android控件的属性

    android控件的属性 本节描述android空间的位置,内容等相关属性及属性的含义 第一类:属性值为true或false android:layout_centerHrizontal 水平居中 ( ...

  3. Android 控件属性

    TextView 文字属性//文字左右居中android:layout_centerHorizontal="true"//文字垂直居中android:layout_centerVe ...

  4. Android控件之ImageSwticher

    Android控件之ImageSwticher 1. ImageSwticher介绍 ImageSwitcher是图片切换的控件,它能实现图片切换时的动画效果,包括图片导入效果.图片消失效果等等.An ...

  5. Android控件GridView之仿支付宝钱包首页带有分割线的GridView九宫格的完美实现

    Android控件GridView之仿支付宝钱包首页带有分割线的GridView九宫格的完美实现 2015-03-10 22:38 28419人阅读 评论(17) 收藏 举报  分类: Android ...

  6. Android控件介绍

    1. 介绍 Android控件大多位于android.widget, android.view.View为他们的父类对于Dialog系列, android.app.Dialog为父类 Android的 ...

  7. Android控件常见属性

    1.宽/高android:layout_width android:layout_height// 取值match_parent //匹配父控件wrap_content //自适应,根据内容 如果指定 ...

  8. [Android Pro] android控件ListView顶部或者底部也显示分割线

    reference to  :  http://blog.csdn.net/lovexieyuan520/article/details/50846569 在默认的Android控件ListView在 ...

  9. Android控件Gridview实现仿支付宝首页,Fragment底部按钮切换和登录圆形头像

    此案例主要讲的是Android控件Gridview(九宫格)完美实现仿支付宝首页,包含添加和删除功能:Fragment底部按钮切换的效果,包含四个模块,登录页面圆形头像等,一个小项目的初始布局. 效果 ...

随机推荐

  1. checkbox样式自定义

    1.使用两张图片(选中和未选中),创建一个选择器. 2.使用checkbox的   drawableLeft  drawableRight  等几个属性把选择器设置进去 3.checkbox的butt ...

  2. Android IntentService完全解析 当Service遇到Handler

    一 概述 大家都清楚,在Android的开发中,凡是遇到耗时的操作尽可能的会交给Service去做,比如我们上传多张图,上传的过程用户可能将应用置于后台,然后干别的去了,我们的Activity就很可能 ...

  3. android sdcard信息获取

    手机存储都有两种,一种是 手机自带的存储,称为internal storage,另外一种用户额外插入的存储,称为removable storage (也就是外置sdcard的部分). removabl ...

  4. ggplot2.multiplot:将多个图形使用GGPLOT2在同一页上

    一页多图 介绍 ggplot2.multiplot是一个易于使用的功能,将多个图形在同一页面上使用R统计软件和GGPLOT2绘图方法.这个功能是从easyGgplot2包. 安装并加载easyGgpl ...

  5. 在FireFox中安装Selenium IDE

    第二步:点击查看更多,查找Selenium IDE,安装 第三步:安装好后,在顶部的工具栏里点击"工具",弹出的选项框里出现Selenium IDE,安装完毕.

  6. 常用js总结1

    1.cookie.js(封装了cookie的基本操作) 1.引入cookie.js <script type="text/javascript" src="../j ...

  7. 初学画布canvas的chapter1

    ——这篇读后感是我阅读<写给Web开发人员看的HTML5教程>一书中的第5章画布后的小小看法,由于编程实力有限,很多效果病没有一一去实现,所以只是停留在纸上谈兵的阶段. 画布(canvas ...

  8. Unity-Animator深入系列---API详解

    回到 Animator深入系列总目录 测试Unity版本为5.2.1 人形动画的接口都有标注 本列表不包含所有标注为过时的方法 1.Vector3 angularVelocity { get; } [ ...

  9. IntelliJ IDEA中使用综合使用Maven和Struts2

    在Intellij IDEA中手动使用Maven创建Web项目并引入Struts2 创建一个新的Maven项目 建好项目之后点击左下角的enable auto import 项目部署 在Moudule ...

  10. 运行时c函数

    // 修改isa,本质就是改变当前对象的类名    object_setClass(self, [XMGKVONotifying_Person class]); // self动态添加关联    // ...