如上图,drawable中不只是可以放bitmap  还可以定制不同形状

 <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 圆角矩形实形 -->
<corners android:radius="50dp"/>
<!--实体颜色 -->
<solid android:color="#336699"/> </shape>

然后到layout中布局ImageView

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:padding="10dp"
android:gravity="center"
android:background="@drawable/btn"
android:text="登录"
android:textColor="@android:color/white"/> <EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="111"/>
<!-- 去掉默认的background或者button @null -->
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:padding="10dp"
android:text="222"/>
<!-- 画一根线 -->
<View
android:layout_width="match_parent"
android:layout_height="3px"
android:layout_margin="5dp"
android:background="@android:color/darker_gray"/> <!-- android:src="@drawable/about" 引用图片资源 -->
<!-- android:adjustViewBounds="true" 拉伸按原图宽高比 -->
<!--android:scaleType="fitXY" 拉伸图片 -->
<ImageButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:src="@drawable/about"
android:adjustViewBounds="true"
android:scaleType="fitXY"/> </LinearLayout>

效果图如下:

Android ImageView的更多相关文章

  1. Android ImageView显示本地图片

    Android ImageView 显示本地图片 布局文件 <?xml version="1.0" encoding="utf-8"?> <R ...

  2. Android ImageView圆形头像

    转载自:http://m.oschina.net/blog/321024 Android ImageView圆形头像 图片完全解析 我们在做项目的时候会用到圆形的图片,比如用户头像,类似QQ.用户在用 ...

  3. android imageview使用的时候 引用资源src和background的区别

    android imageview使用的时候 引用资源时src和background的区别 src更强调内容并且不行拉伸图片进行适配,而background更注重引用图片,会对图片进行拉伸

  4. 【转】Android ImageView圆形头像

    Android ImageView圆形头像 图片完全解析 我们在做项目的时候会用到圆形的图片,比如用户头像,类似QQ.用户在用QQ更换头像的时候,上传的图片都是矩形的,但显示的时候确是圆形的. 原理: ...

  5. Android ImageView加载圆形图片且同时绘制圆形图片的外部边缘边线及边框

     Android ImageView加载圆形图片且同时绘制圆形图片的外部边缘边线及边框 在Android早期的开发中,如果涉及到圆形图片的处理,往往需要借助于第三方的实现,见附录文章1,2.And ...

  6. Android ImageView 不显示JPEG图片 及 Android Studio中怎样引用图片资源

    Android ImageView 不显示JPEG图片 今天在写一个小实例,ImageView在xml里面设置的是INVISIBLE,在代码里须要设置成setVisibility(View.VISIB ...

  7. [转]Android ImageView的scaleType属性与adjustViewBounds属性

    Android ImageView的scaleType属性与adjustViewBounds属性   ImageView的scaleType的属性有好几种,分别是matrix(默认).center.c ...

  8. android ImageView网络图片加载、动态设置尺寸、圆角..

    封装了一个关于ImageView的辅助类,该类可以方便实现网络图片下载的同时,动态设置图片尺寸.圆角.....一系列连贯的操作,无样式表,java代码实现所有功能,使用很方便. package com ...

  9. 【腾讯Bugly干货分享】Android ImageView 正确使用姿势

    本文来自于腾讯bugly开发者社区,未经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/5832602d7196970d65901d76 导语 本文主要介绍了ImageV ...

  10. Android ImageView图片透明区域不响应点击事件,不规则图片透明区域响应点击事件

    转载:http://blog.csdn.net/aminfo/article/details/7872681 经常会在项目中用到透明图片,不规则图片,特别是做游戏的时候,需要对图片的透明区域的点击事件 ...

随机推荐

  1. XlFileFormat

    -----转载:http://hi.baidu.com/liu_haitao/item/900ddb38979188c22f8ec26e 18 XlFileFormat.xlAddIn Microso ...

  2. 一个PHP开发者总结的九条建议

    本文只是个人从实际开发经验中总结的一些东西,并不是什么名言警句,写出来有两个目的:一是时刻提醒自己要按照这些知识点来写自己代码,二是为了分享,说不定对你有用呢?万一,是吧... 1.首要意识:安全 大 ...

  3. Swift - 27 - 使用元组让函数返回多个值

    //: Playground - noun: a place where people can play import UIKit // 定义一个数组 var userScores:[Int]? = ...

  4. ajax调试兼容性

    <script type="text/javascript"> if(typeof ActiveXObject!= 'undefined'){ var x = new ...

  5. apple

    you are the apple of my eye

  6. openMPI小集群安装

    经过一天的努力,终于完成了openMPI的多节点安装,即小集群安装.本文使用的是openmpi-1.6.5,下载地址见:http://www.open-mpi.org/software/ompi/v1 ...

  7. CentOS 6.5下安装MySql 5.7

    不管您按下面的方法安装成功否,请留个言,把您遇到的问题写上共勉! 包下载http://url.cn/WrNg5S 环境: 1).软硬件:E6420双核CPU,8G内存,1T硬盘 2).虚拟机下 Cen ...

  8. ubuntu 更新 php5.5.9 到 php 5.6

    add-apt-repository ppa:ondrej/php5-5.6 apt-get update apt-get install php5 为了使用 add-apt-repsitory 需要 ...

  9. 谈.Net委托与线程——解决窗体假死

    转自:http://www.cnblogs.com/smartls/archive/2011/04/08/2008981.html#2457370   引言 在之前的<创建无阻塞的异步调用> ...

  10. win7 该任务映像已损坏或一篡改

    首先找到任务计划程序快捷方式的位置,我的是win7系统,是在:控制面板-->管理工具-->任务计划程序 打开任务计划程序出现了下面的异常提示: 出现了这个异常之后,创建任务.创建基本任务菜 ...