scaleType是指定图片的拉伸方式的一个属性,下面是具体的示例和介绍:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> <ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" > <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="将图片渲染为制定颜色" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#000000"
android:tint="#ff0000"
android:src="@drawable/ic_launcher" /> <!-- 拉伸图片(不按比例)以填充View的宽高 -->
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="拉伸图片(不按比例)以填充View的宽高" /> <ImageView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:background="#000000"
android:src="@drawable/ic_launcher" /> <!-- 按比例拉伸图片,拉伸后图片的高度为View的高度,且显示在View的左边 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="按比例拉伸图片,拉伸后图片的高度为View的高度,且显示在View的左" /> <ImageView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:scaleType="fitStart"
android:background="#000000"
android:src="@drawable/ic_launcher" /> <!-- 按比例拉伸图片,拉伸后图片的高度为View的高度,且显示在View的中间 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="按比例拉伸图片,拉伸后图片的高度为View的高度,且显示在View的中间" />
<ImageView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:background="#000000"
android:src="@drawable/ic_launcher" /> <!-- 按比例拉伸图片,拉伸后图片的高度为View的高度,且显示在View的右边 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="按比例拉伸图片,拉伸后图片的高度为View的高度,且显示在View的右边" />
<ImageView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:scaleType="fitEnd"
android:background="#000000"
android:src="@drawable/ic_launcher" /> <!-- 按原图大小显示图片,但图片宽高大于View的宽高时,截图图片中间部分显示 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="按原图大小显示图片,但图片宽高大于View的宽高时,截图图片中间部分显示" />
<ImageView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:scaleType="center"
android:background="#000000"
android:src="@drawable/ic_launcher" />
</LinearLayout>
</ScrollView>
</LinearLayout>

ImageView中scaleType属性详解的更多相关文章

  1. Android中的ImageView的scaleType属性详解

    ImageView的Scaletype决定了图片在View上显示时的样子,如进行何种比例的缩放,及显示图片的整体还是部分,等等. 设置的方式包括: 1. 在layout xml中定义android:s ...

  2. DIV css中cursor属性详解-鼠标移到图片变换鼠标形状 (转)

    css中cursor属性详解-鼠标移到图片变换鼠标形状   语法: cursor : auto | all-scroll | col-resize| crosshair | default | han ...

  3. Javascript中prototype属性详解 (存)

    Javascript中prototype属性详解   在典型的面向对象的语言中,如java,都存在类(class)的概念,类就是对象的模板,对象就是类的实例.但是在Javascript语言体系中,是不 ...

  4. CSS中background属性详解

    CSS背景属性 background css 说明 background-image:url(图片的网址); 背景图 background: url( 图片的网址 ); 背景 background-c ...

  5. Android中shape属性详解

    一.简单使用 刚开始,就先不讲一堆标签的意义及用法,先简单看看shape标签怎么用. 1.新建shape文件 首先在res/drawable文件夹下,新建一个文件,命名为:shape_radius.x ...

  6. spring sessionFactory 属性配置详解,applicationContext中各种属性详解

    1.Bean的id为sessionFactory,对应的类为AnnotationSessionFactory,即采用注解的形式实现hibernate. 2.hibernateProperties,配置 ...

  7. Javascript中prototype属性详解

    在典型的面向对象的语言中,如java,都存在类(class)的概念,类就是对象的模板,对象就是类的实例.但是在Javascript语言体系中,是不存在类(Class)的概念的,javascript中不 ...

  8. Hibernate 中配置属性详解(hibernate.properties)

    Hibernate能在各种不同环境下工作而设计的, 因此存在着大量的配置参数.多数配置参数都 有比较直观的默认值, 并有随 Hibernate一同分发的配置样例hibernate.properties ...

  9. laravel--模型中各种属性详解

    首先以这个模型为例 首先看, 1.$guarded属性,$fillable属性 $guarded属性一般是和$fillable对应的,不是一起存在但是互相使用,他们都是laravel的批量赋值方法cr ...

随机推荐

  1. GMM实战

    一道作业题: https://www.kaggle.com/c/speechlab-aug03 就是给你训练集,验证集,要求用GMM(混合高斯模型)预测 测试集的分类,这是个2分类的问题. $ hea ...

  2. Codeforces Round #189 (Div. 1) C - Kalila and Dimna in the Logging Industry 斜率优化dp

    C - Kalila and Dimna in the Logging Industry 很容易能得到状态转移方程 dp[ i ] = min( dp[ j ] + b[ j ] * a[ i ] ) ...

  3. 【IObit】五大软件激活码( Advanced Systemcare....)

    IObit Malware Fighter 6Pro 破解: 打开软件安装位置,下载替换dll文件 链接: https://pan.baidu.com/s/1Euz87MCANuCnRqZsMQ_w4 ...

  4. Codeforces Round 542 (Div. 2)

    layout: post title: Codeforces Round 542 (Div. 2) author: "luowentaoaa" catalog: true tags ...

  5. Win7无法添加用户的问题

    这段时间搞dcom的东西,然后按照网上说的,用dcomcnfg打开管理器,在dcom中我的电脑里面属性中把默认身份验证级别改为 无.然后再使用的时候,发现win7中的账户管理里面,什么账户都没有了,不 ...

  6. 24.python中类的方法

    类中的方法,其实就是类中的函数,可以分为:实例方法,类方法,静态方法.方法和字段一样,也是属于类的属性,所以也具有运行中修改的特效, 但一般不推荐这样做. 我在类的基本语法中,介绍了构造器方法:__i ...

  7. Node.js用6行代码1个JS文件搭建一个HTTP静态服务器

    Node.js是一个基于Chrome的JavaScript运行时的用户以轻松构建快速.可扩展的网络应用平台. Node.js使用事件驱动.非阻塞I/ O模型,使它轻量级.高效和完美的适用于运行在分布式 ...

  8. BZOJ1768 : [Ceoi2009]logs

    从上到下枚举行,可以$O(m)$更新现在每一列往上连续的1的个数,也可以在$O(m)$的时间内完成排序.总复杂度$O(nm)$. #include<cstdio> #define M 15 ...

  9. Develop with asyncio部分的翻译

    Develop with asyncio 异步程序和普通的连续程序(也就是同步程序)是很不一样的,这里会列出一些常见的陷阱,并介绍如何去避开他们. Debug mode of asyncio 我们用a ...

  10. 用户 'IIS APPPOOL\DefaultAppPool' 登录失败【收藏】

    转载:http://blog.csdn.net/wenjie315130552/article/details/7246143 问题是应用程序连接池的问题.网上有些朋友说是Temp文件夹的权限的问题. ...