如上图,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. Linux网络配置命令ifconfig输出信息解析

    eth0      Link encap:Ethernet  HWaddr 00:1e:4f:e9:c2:84 inet addr:128.224.163.153  Bcast:128.224.163 ...

  2. openMPI小集群安装

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

  3. TalkingData游戏版本在Cocos2d-x 3.2使用

    最近一直忙别的方面的事情,没有太关注cocos2dx的发展情况,竟然已经更新到了3.2的版本,总的来说3.2比较3.0在使用上会有一些路径的变成,包括ios的引用路径和android上的build的p ...

  4. CSS样式的面向对象思想(一)

    今天来谈一谈CSS样式的面向对象写法.顾名思义,面向对象是高级语言具备的特性,主要是为了程序高可复用,解决模块之间的耦合关系,那么像CSS这样的脚本语言是否也可以使用面向对象的思想,来提高代码的可维护 ...

  5. [HTML5 Canvas学习]绘制矩形

    1.使用strokeRect和fillRect方法绘制矩形 a.strokeRect是绘制一个不填充的矩形 b.fillRect是绘制一个填充的矩形 代码: <script> var ca ...

  6. 给AVS添加描述(how to add a description to a video)

    UPDATE you might need edit few files. 1. add the input field to the tpl file: /templates/frontend/yo ...

  7. python:UnboundLocalError: local variable 'xxx' referenced before assignment

    近来一直都在学习python语言,偶然在伯乐在线看到2017年京东C/C++的面试题.就打算用python+ST3 IDE顺便敲下面试题代码. 原题 C语言: #include <stdio.h ...

  8. USACO1.5 Checker Challenge(类n皇后问题)

    B - B Time Limit:1000MS     Memory Limit:16000KB     64bit IO Format:%lld & %llu   Description E ...

  9. iOS App转让流程

    说法一: (1)选择转让APP (2)进入转让界面       点击Continue进入下一步   (3)输入对方的APP ID和Team ID     Apple ID 和 Team ID 可以在m ...

  10. 关于Java中重载的若干问题

    一.问题引入 今天看视频时偶然间看到了,说父类和子类间也可以重载,貌似和以前的观念有些冲突,就验证了下…… 二.问题解决 看如下代码: public class Son extends Father ...