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 ...
随机推荐
- IntelliJ IDEA 设置Output 窗口字体大小
Settings——>Editor——>Colors&Fonts——>Console Font 如图: 字体调好了以后使用起来眼睛就轻松多了
- spring-cloud-sleuth+zipkin追踪服务实现(四)
1.前言 在上一篇spring-cloud-sleuth+zipkin追踪服务实现(三)的处理实现后,很多朋友告诉我,在zipkin server的管理页面无法看到项目依赖关系. 当时也没有多想,以为 ...
- 报错:-bash: locate: command not found
-bash: locate: command not found 查看某些文件在哪些地方,需要用到 locate 命令 但是在安装 yum install locate 会报以下错误: -bash: ...
- k8s 集群中的etcd故障解决
一次在k8s集群中创建实例发现etcd集群状态出现连接失败状况,导致创建实例失败.于是排查了一下原因. 问题来源 下面是etcd集群健康状态: [root@docker01 ~]# cd /opt/k ...
- BZOJ.1007.[HNOI2008]水平可见直线(凸壳 单调栈)
题目链接 可以看出我们是要维护一个下凸壳. 先对斜率从小到大排序.斜率最大.最小的直线是一定会保留的,因为这是凸壳最边上的两段. 维护一个单调栈,栈中为当前可见直线(按照斜率排序). 当加入一条直线l ...
- BZOJ2081 : [Poi2010]Beads
暴力枚举$k$,对于一个子串,计算它正着的hash值以及反着的hash值,取最小值得到其最终hash值. 对于$k$,一共有$\lfloor\frac{n}{k}\rfloor$个子串,计算出它们的最 ...
- input文字颜色、光标颜色
<input type="text" placeholder="输入框"> input{ color: red;/*输入文字.光标颜色*/ -web ...
- FireDAC 下的 Sqlite [3] - 获取数据库的基本信息
在空白窗体上添加: TFDConnection, TFDPhysSQLiteDriverLink, TFDGUIxWaitCursor, TMemo procedure TForm1.FormCrea ...
- Spring 注解学习手札(七) 补遗——@ResponseBody,@RequestBody,@PathVariable(转)
最近需要做些接口服务,服务协议定为JSON,为了整合在Spring中,一开始确实费了很大的劲,经朋友提醒才发现,SpringMVC已经强悍到如此地步,佩服! 相关参考: Spring 注解学习手札(一 ...
- Cygwin、MinGw、mingw-w64,MSys msys2区别与联系
https://www.biaodianfu.com/cygwin-ming-msys.html http://www.mingw-w64.org/doku.php http://blog.csdn. ...