当前位置:网站首页>Kotlin of Android cultivation manual - several ways to write a custom view
Kotlin of Android cultivation manual - several ways to write a custom view
2022-06-25 17:43:00 【sesame seeds】
- Click the jump =>《 Navigation post 》- Unity manual , Systematic practical learning
- Click the jump =>《 Navigation post 》- Android manual , Revisit mobile development
This article is about 2.6 Thousand characters , Novice reading needs 4 minute , Review needs 1 minute 【 Collect at any time, no longer get lost 】
About author
as everyone knows , Life is a long process , constantly overcome difficulties , Constantly reflect on the process of progress . In this process, there will be a lot of questions and thoughts about life , So I decided to put my thinking , Share all your experiences and stories , To find resonance !!!
Focus on Android/Unity And various game development skills , as well as Share various resources ( Website 、 Tools 、 material 、 Source code 、 Games etc. )
If you need anything, welcome me , Communication groups make learning No longer alone .

Premise
This is what Xiao Kong insisted on writing Android Novice series , Welcome to taste .
bosses (√)
Novice (√√√)
Practice process
Use Kotlin Not used to it , Take notes .
There are three ways
Mode one
recommend , Note that the first two construction parameters are this, instead of super
class WaveViewKotlin: View{
constructor(context: Context?) :this(context,null)
constructor(context: Context?, attrs: AttributeSet?) :this(context,attrs,0)
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
init {
// Initialization method
}
override fun onDraw(canvas: Canvas) {
}
}
perhaps
class WaveViewKotlin: View{
constructor(context: Context?, attrs: AttributeSet?) :super(context,attrs)
init {
// Initialization method
}
override fun onDraw(canvas: Canvas) {
}
}
Mode two
The other one parameter and three parameters are infeasible
class WaveViewKotlin(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
init {
// Initialization method
}
override fun onDraw(canvas: Canvas) {
}
}
Mode three
The premise is that the project's build In the configuration kotlin Plug in for .
class WaveViewKotlin @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : View(context, attrs, defStyleAttr){
init {
// Initialization method
}
override fun onDraw(canvas: Canvas) {
}
}
other
author : Xiaokong and Xiaozhi Xiaokong
Reprint note - Be sure to indicate the source :https://zhima.blog.csdn.net/
This Taoist friend, please Step back ️, I watch you Extraordinary bearing , There is a king's domineering spirit in his speech , There will be a great achievement in the future !!! There is give the thumbs-up Collection Today I tell you , Have you ordered it , Your success in the future ️, I don't take a penny , If it doesn't work ️, Or come back to me .
reminder : Click the card below to get more unexpected resources .
边栏推荐
- mvdr波束 matlab,mvdr波束形成matlab[通俗易懂]
- 匯編語言(5)寄存器(內存訪問)
- cgi通过odbc连接数据库
- BILSTM和CRF的那些事
- Sentinel sentinel mechanism
- Unity technical manual - lifecycle rotation rotationoverlifetime speed rotation rotationbyspeed external forces
- Jerry's addition of encrypted file playback function [chapter]
- Mathematical modeling - linear programming
- 证券公司排名前十手续费最低 办理开户安全吗
- Jerry's ADC_ get_ Incorrect voltage value obtained by voltage function [chapter]
猜你喜欢

UART波特率对时钟精度的要求有多高?

WPF development essays Collection - ECG curve drawing
![[compilation principle] lexical analysis](/img/b2/8f7dea3944839e27199b28d903d9f0.png)
[compilation principle] lexical analysis

杰理之唤醒口使用注意事项【篇】

Why do we need ankeri's active power filter in frequency converter occasions?

【编译原理】词法分析

Distinguishing seven kinds of facial expressions by deep separable convolution neural network

什么是算子?

杰理之adc_get_voltage 函数获取电压值不准【篇】
![[compilation principle] overview](/img/af/246750beb72842e83a19e42270c09e.png)
[compilation principle] overview
随机推荐
Golang sort slice int
卷积操作的本质特性+TextCNN文本分类
什么是公链开发?公链开发项目有哪些?
C语言中%含义
VSCode 自动生成头文件的#ifndef #define #endif
Vscode / * * generate function comments
【Matlab】数值微积分与方程求解
[UVM practice== > episode_2] ~ VIP, VIP development, VIP release
Introduction to the container of() function
观察者模式之通用消息发布与订阅
使用DiskGenius拓展系統盤C盤的容量
超全金屬PBR多通道貼圖素材網站整理
深入理解ELF文件
Treasure and niche Chinese painting 3D texture material website sharing
Distributed remote management of distribution room environment
Mathematical modeling - nonlinear programming
Precautions for use of Jerry's SPI slave [chapter]
Interrupt operation: abortcontroller learning notes
Precautions for using Jerry's timer [chapter]
Unity technical manual - lifecycle rotation rotationoverlifetime speed rotation rotationbyspeed external forces