NetBlog主题
2025-01-17
53
效果图一、添加依赖在build.gradle文件中添加 MPAndroidChart 的依赖dependencies { //其它的依赖 implementation ("com.github.PhilJay:MPAndroidChart:v3.1.0")}在settings.gradle文件中添加dependencyResolutionManagement { repositoriesMode.set(Repositories…
2024-12-31
78
1.创建自定义 View,创建一个继承自View的自定义类,在这个类中实现波形图的绘制逻辑。package com.zhkh.khpec.utilityimport android.content.Contextimport android.graphics.Canvasimport android.graphics.Colorimport android.graphics.Paintimport android.util.Att…
2024-12-20
139
private fun cIsEnabled(b:Boolean){ runOnUiThread { binding.rbYS2.isEnabled=b binding.rbYS.isEnabled=b }}本文来自www.LuoFenMing.com
2024-12-20
129
@SuppressLint("DefaultLocale")@RequiresApi(Build.VERSION_CODES.O)private fun CalculationTime(){ val dt11 = System.currentTimeMillis() // 获取当前时间(毫秒) while (true){ val dt21 = System.currentTimeMillis() // 再次获取当前时间(毫秒)…
2024-12-17
242
引用第三方库libs.versions.toml添加配置[versions]androidSerialportVersion = "2.1.3"[libraries]licheedev-android-serialport = { module = "com.licheedev:android-serialport", version.ref = "androidSerialportVersion" }build.gradle.kts添加配置dependencies { …
2024-12-05
161
效果图自定义activity_userinfo.xml文件代码?xml version="1.0" encoding="utf-8"?LinearLayout xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" androi…
2024-12-04
135
fun getCodeInfo(element: ArrayStackTraceElement):String { val fileName = element[2].fileName val lineNumber = element[2].lineNumber return "lqwvje,当前代码位于文件:$fileName ,行号:$lineNumber"}方法调用val msg=getCodeInfo(Thread.currentThr…
2024-11-15
248
效果如下核心代码private fun showConfirmationDialog(context:Context) val builder = AlertDialog.Builder(context) builder.setTitle("确认操作") .setMessage("你确定要删除吗?") .setPositiveButton("确定") { dialog, which - //…
2024-11-05
267
package com.zhkh.khpec.utilityimport android.annotation.SuppressLintimport android.content.Contextimport android.database.sqlite.SQLiteDatabaseimport android.database.sqlite.SQLiteOpenHelperclass DatabaseHelper(context: Context?) : SQLiteOpenHelper(con…
2024-10-30
461
val s = "罗分明"val byteArray = s.toByteArray(Charsets.UTF_8)//打印输出 e7 bd 97 e5 88 86 e6 98 8eprintln(byteArray.toHexString().chunked(2).joinToString(" "))val s2 = String(byteArray, Charsets.UTF_8)//打印输出 罗分明println(s2)本文来自www.luofenmin…