kotlin

Android自定义View相关总结

梦想的初衷 提交于 2020-09-30 12:20:36
继承View重写onDraw方法 通常用于实现复杂的、不规则的效果,需要自己支持wrap_content和padding。自定义圆形进度条组件的kotlin代码 class MyCircleProgress : View { private var mWidth = 0 private var mHeight = 0 private var progress = 0.6 constructor ( context : Context ) : super ( context ) { } constructor ( context : Context , attr : AttributeSet ) : super ( context , attr ) { } private fun dp2px ( dp : Int ) : Int { return TypedValue . applyDimension ( TypedValue . COMPLEX_UNIT_DIP , dp . toFloat ( ) , Resources . getSystem ( ) . displayMetrics ) . toInt ( ) } override fun onMeasure ( widthMeasureSpec : Int , heightMeasureSpec : Int ) {

Android 开发技术周报 Issue#295

你说的曾经没有我的故事 提交于 2020-09-30 06:38:34
新闻 Android Generic项目让定制ROM在PC上更容易安装 Android Auto获得更新 彻底改变了设置菜单使之更容易体验 Android UI开发框架Jetpack Compose进入Alpha测试阶段 教程 重要变更 | Android 11 中的软件包可见性 Android 中的卡顿丢帧原因概述 - 方法论 Android Material 组件 1.2.0 现已发布 在 View 上使用挂起函数 | 实战 Android 样式系统 | 主题背景属性 开源库 Showkase an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements dslint A lightweight Android linter for Kotlin DSL aimed to solve the problem of verifying mandatory DSL attributes at compile time. StatusNavigationTransparent Android屏幕适配之状态栏导航栏半透明、全透明(5.0以上去阴影),方法多样 lint-rules Lint