当前位置:网站首页>Use kotlin to extend plugins/dependencies to simplify code (after the latest version 4.0, this plugin has been deprecated, so please choose to learn, mainly to understand.)
Use kotlin to extend plugins/dependencies to simplify code (after the latest version 4.0, this plugin has been deprecated, so please choose to learn, mainly to understand.)
2022-07-30 06:55:00 【RMB iraqis alone drunk】
1. Add a plugin to replace findViewById(XXX);
id 'kotlin-android-extensions'
Replaces findViewById(XXX)
You can use the control id on the View directly in the kotlin code.

2. Extension plug-in anko
A lot of extension functions are added inside
For example, toast can be simplified.

build.gradle(Module):


anko_version is defined in build.gradle(project)ext.anko_version='0.10.8'implementation "org.jetbrains.anko:anko-common:$anko_version"activity_main2.xml

MainActivity2.kt

Effect:

After the latest version 4.0, this plug-in has been deprecated, so please learn selectively and focus on understanding.
The use of the ViewBinding method has appeared since then, and the use of this method will be updated in the later stage.
边栏推荐
猜你喜欢

oracle row to column, column to row summary

SQL Server database generation and execution of SQL scripts

线程的5种状态

第一个WebAssembly程序

Detailed introduction to the usage of Nacos configuration center

C#下利用开源NPlot绘制股票十字交叉线

DVWA installation tutorial (understand what you don't understand · in detail)

国内数字藏品交易平台开发市场会开放二级市场吗

The operations engineer interview experience

Function 函数式接口及应用
随机推荐
ClickHouse查询语句详解
Mycat2.0搭建教程
The most powerful and most commonly used SQL statements in history
Deserialization character escape
mysql删除表中重复数据,(只保留一行)
JVM学习(二) 垃圾收集器
misc-log analysis of CTF
Volatility memory forensics - command shows
oracle row to column, column to row summary
MySQL开窗函数
SQL Server 数据库之生成与执行 SQL 脚本
MySQL 5.7 安装教程(全步骤、保姆级教程)
sqli-labs less3/4 Targeting Notes
Flink CDC implements Postgres to MySQL streaming processing transmission case
sql中 exists的用法
Flink CDC 实现Postgres到MySQL流式加工传输案例
Remember a Mailpress plugin RCE vulnerability recurrence
Operators and Interaction Basics
C#中使用OleDb操作access数据库
MySQL 索引优化及失效场景