当前位置:网站首页>Thoroughly remember the difference between ImageView background and SRC
Thoroughly remember the difference between ImageView background and SRC
2022-06-11 07:55:00 【tinyvampirepudge】
Remember thoroughly ImageView Of background and src The difference between
Sample code
<ImageView
android:id="@+id/iv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher"
android:src="@drawable/ic_launcher" />
difference :
①background Will be based on ImageView Width and height of control , The tensile Drawable;src Will keep Image The size of the
②background It's the background ,src It's the content (foreground), They can exist at the same time .
③ScaleType Will only work on src above .
background:
background yes View Properties of , The concrete is android.R.styleable#View_background attribute , Its effective time is View#draw(Canvas canvas) Method .
stay View#draw(Canvas canvas) In the method , Will call first View#drawBackground(Canvas canvas) Method to draw the background .
It will then call onDraw、dispatchDraw、onDrawForeground Other methods .
src:
src yes ImageView Properties of , The concrete is android.R.styleable#ImageView_src attribute , It's in onDraw Method mDrawable Attribute , The specific call time is background After drawing .
Reference resources
The difference between SRC and background in Android _android
边栏推荐
- [cluster] lvs+keepalived high availability cluster
- 【AtCoder2304】Cleaning
- 安卓初中级开发基础知识整理(面试自用)
- After 4 years of naked resignation from the test, the test post of 15K interview was rubbed on the ground, and the result made me collapse and cry
- Logical implication of functional dependence
- 2022.6.6 extra long growth simulation
- Space geometry
- Detailed explanation of shift operator and bit operator in C language
- How to prepare for the new PMP syllabus exam?
- Printing diamond of beginner C
猜你喜欢

Figure seamless database integration tushare interface

C language - Growth Diary -03- function definition and function prototype declaration

Crawl Baidu Baipin dynamic page

签到体系设计:签到功能该怎么画

Getting started with bladed tutorial (video)

C language - Growth Diary -01- count primes and sum

Bladed入門教程(視頻)

After 4 years of naked resignation from the test, the test post of 15K interview was rubbed on the ground, and the result made me collapse and cry

mpi

C language - Growth Diary -02- function
随机推荐
Return in foreach and break in for
[atcoder1984] wide swap
YUV数据的裁剪与重叠
(transformation) tree, binary tree and forest transformation principle
排序——交换排序
Introduction to operations research
TiDB Cloud 上線 Google Cloud Marketplace,以全新一棧式實時 HTAP 數據庫賦能全球開發者
Zero foundation self-study SQL course | union joint query
Getting started with bladed tutorial (video)
C language to achieve minesweeping games
TypeScript-在koa中配置TS和使用koa-router
放大镜子效果图
学习《缠解论语》
SOCKET【5】- struct linger 用法
TypeScript-类型别名
multi-sig SC
860. 柠檬水找零
用 Keras/TensorFlow 2.9 创建深度学习模型的方法总结
TypeScript-键盘映射
Request request object and response response object