当前位置:网站首页>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
边栏推荐
- How to find the complementary sequence of digraph
- TypeScript-枚举
- 【AtCoder2304】Cleaning
- C. Manipulating History(贪心/哈希/思维/好题)
- C- print 99 multiplication table
- Batch splice string
- Methods to improve training speed in deep learning and techniques to reduce video memory (suitable for entry-level trick without too many computing resources)
- 【AtCoder2387】+/- Rectangle
- C wechat upload form data
- 2022.6.7 特长生模拟
猜你喜欢

Detailed explanation of shift operator and bit operator in C language

Bubble sorting with C language
![[atcoder1980] mystious light (mathematical simulation)](/img/c0/7de31b36e11ff71328d927c1d1c2d3.png)
[atcoder1980] mystious light (mathematical simulation)
![[atcoder2306] rearranging (topology)](/img/b3/38589a07a7c26bea8ed154ab794760.png)
[atcoder2306] rearranging (topology)

Storage of floating point in memory

How to output the percent sign "%" in printf function in C language

Zero foundation self-study SQL course | union joint query

2022.6.6 extra long growth simulation

Black Qunhui dsm7.0.1 physical machine installation tutorial

批量拼接字符串
随机推荐
Label the mask image not obtained through labelme
134. 加油站
Semiconductor memory classification
[poj3691] DNA repair (AC automata +dp)
[atcoder1981] short diameter (graph theory thinking)
Socket [5] - struct linker usage
Bladed入门教程(视频)
multi-sig SC
(transformation) tree, binary tree and forest transformation principle
安卓初中级开发基础知识整理(面试自用)
About static keyword
. Net C Foundation (6): namespace - scope with name
【HDU6357】Hills And Valleys(DP)
Crawl Baidu Baipin dynamic page
TypeScript-可辨识联合
自定义ViewGroup的知识点总结-持续更新
C- print 99 multiplication table
2. Graduated from this course, and the bank has outsourced testing work for more than 4 months. Talk about some real feelings
Using Tkinter to realize guessing numbers game
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