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. linux通过wget直接下载jdk

    下载语句: tar包下载 wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-se ...

  2. React、Redux 和 Bootstrap

    使用 React.Redux 和 Bootstrap 实现 Alert 今天,我们来学习使用 React.Redux 和 Bootstrap 实现Alert. 例子 这个例子实现了弹出不同类型信息的功 ...

  3. 【LOJ】#2090. 「ZJOI2016」旅行者

    题解 每次按较长边把矩形分成两半,找一个中间轴,轴上的每个点跑一边最短路更新所有的答案 然后把矩形分成两半,递归下去 代码 #include <bits/stdc++.h> #define ...

  4. django 使用 request 获取浏览器发送的参数

    django 使用 request 获取浏览器发送的参数     转载请注明出处 https://blog.csdn.net/fanlei5458/article/details/80638348 获 ...

  5. 深入理解Git - 一切皆commit

    在对 git 有了基本理解和知道常规操作之后,如何对 git 的使用有进一步的理解? 一切皆 commit 或许是个不错的理解思路. 本文将从『一切皆 commit 』的角度,通过 git 中常见的名 ...

  6. JAVA 图形开发中组件对齐方法及界面开发

    /*文章中用到的代码只是一部分,需要源码的可通过邮箱联系我 1978702969@qq.com*/ 在上篇博客中提到了JAVA图形界面开发时的两种布局,流式布局和边框布局. 在实际使用中可能会发现,往 ...

  7. html (第四本书第七章浮动参考)

    课上1 <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8 ...

  8. IE9中ajax请求成功后返回值却是undefined

    ie9中ajax请求一般处理程序成功后返回值始终是undefined,在网上找过很多资料,大致意思都是说前后端编码不一致造成的,但是按照资料上的方案去修改却发现根本不能解决我的问题,试过好多种方案都不 ...

  9. BZOJ.3673/3674.可持久化并查集(可持久化线段树 按秩合并/启发式合并)

    BZOJ 3673 BZOJ 3674(加强版) 如果每次操作最多只修改一个点的fa[],那么我们可以借助可持久化线段树来O(logn)做到.如果不考虑找fa[]的过程,时空复杂度都是O(logn). ...

  10. win10 下 配置php环境变量

    注意,只需要配置到目录即可: