ImageView中scaleType属性详解

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属性详解的更多相关文章
- Android中的ImageView的scaleType属性详解
ImageView的Scaletype决定了图片在View上显示时的样子,如进行何种比例的缩放,及显示图片的整体还是部分,等等. 设置的方式包括: 1. 在layout xml中定义android:s ...
- DIV css中cursor属性详解-鼠标移到图片变换鼠标形状 (转)
css中cursor属性详解-鼠标移到图片变换鼠标形状 语法: cursor : auto | all-scroll | col-resize| crosshair | default | han ...
- Javascript中prototype属性详解 (存)
Javascript中prototype属性详解 在典型的面向对象的语言中,如java,都存在类(class)的概念,类就是对象的模板,对象就是类的实例.但是在Javascript语言体系中,是不 ...
- CSS中background属性详解
CSS背景属性 background css 说明 background-image:url(图片的网址); 背景图 background: url( 图片的网址 ); 背景 background-c ...
- Android中shape属性详解
一.简单使用 刚开始,就先不讲一堆标签的意义及用法,先简单看看shape标签怎么用. 1.新建shape文件 首先在res/drawable文件夹下,新建一个文件,命名为:shape_radius.x ...
- spring sessionFactory 属性配置详解,applicationContext中各种属性详解
1.Bean的id为sessionFactory,对应的类为AnnotationSessionFactory,即采用注解的形式实现hibernate. 2.hibernateProperties,配置 ...
- Javascript中prototype属性详解
在典型的面向对象的语言中,如java,都存在类(class)的概念,类就是对象的模板,对象就是类的实例.但是在Javascript语言体系中,是不存在类(Class)的概念的,javascript中不 ...
- Hibernate 中配置属性详解(hibernate.properties)
Hibernate能在各种不同环境下工作而设计的, 因此存在着大量的配置参数.多数配置参数都 有比较直观的默认值, 并有随 Hibernate一同分发的配置样例hibernate.properties ...
- laravel--模型中各种属性详解
首先以这个模型为例 首先看, 1.$guarded属性,$fillable属性 $guarded属性一般是和$fillable对应的,不是一起存在但是互相使用,他们都是laravel的批量赋值方法cr ...
随机推荐
- Vuejs 高仿饿了么外卖APP 百度云视频教程下载
Vuejs 高仿饿了么外卖APP 百度云视频教程下载 链接:https://pan.baidu.com/s/1KPbKog0qJqXI-2ztQ19o7w 提取码: 关注公众号[GitHubCN]回复 ...
- Js数组里剔除指定的元素(不是指定的位置)
s数组里删除指定的元素(不是指定的位置)之前一直是做后端的,从来也没有写过js,但是却一直想学学,也只是基于兴趣而已!现在到了这个公司,确实大量的写js.但也一直都是没有系统的去看过js!都是搞什么查 ...
- 022 StringTokenizer替换掉String的操作
一:说明 1.说明 String的操作特别消耗内存,所以可以考虑优化. 二:程序 1.程序修改 这部分程序属于Mapper端的程序,稍微优化一下. 2.程序 //Mapper public stati ...
- SQL中的坑
一.where,group by,having --group by 和having 解释:前提必须了解sql语言中一种特殊的函数:聚合函数, 例如SUM, COUNT, MAX, AVG等.这些函数 ...
- 007.LVM查看命令
一 PV查看 [root@kauai ~]# pvdisplay #显示有关物理卷的信息 --- Physical volume --- PV Name /dev/sdb5 #PV名称 VG Name ...
- JAVA 图形开发之计算器设计(事件监听机制)
/*文章中用到的代码只是一部分,需要源码的可通过邮箱联系我 1978702969@qq.com*/ 前段时间刚帮同学用MFC写了个计算器,现在学到JAVA的图形开发,就试着水了一个计算器出来.(可以说 ...
- CentOS7下安装MySQL5.7安装与配置(YUM)
http://blog.csdn.net/xyang81/article/details/51759200 安装环境:CentOS7 64位 MINI版,安装MySQL5.7 1.配置YUM源 在My ...
- [ 转载 ] Java 构造代码块
https://blog.csdn.net/liyunxiangrxm/article/details/80244016
- Wannafly 22A
题解 另g = gcd(a1,a2,a3....) 那么k * g % m的方案书就是答案 这个式子子显然是有循环节的 x * g = 0 mod m ,x * g + y * m = 0 exgcd ...
- JZYZOJ 2041 快速数论变换 NTT 多项式
http://172.20.6.3/Problem_Show.asp?id=2041 https://blog.csdn.net/ggn_2015/article/details/68922404 代 ...