摘要:
一,区别 var var 关键字用于声明一个可变的变量,即这个变量的值可以在程序运行过程中被改变。 val val 关键字用于声明一个不可变的变量,即这个变量的值在初始化后不能被改变。 使用 val 声明的变量必须在声明时或者构造器中初始化,一旦初始化后,其值就不能被改变。 需要注意的地方:val声 阅读全文
posted @ 2025-06-02 12:27
刘宏缔的架构森林
阅读(164)
评论(0)
推荐(0)
摘要:
一,java转kotlin code->Convert Java File to Kotlin File 如图: 弹出提示,需要在项目中配置kotlin 确认 提示一些需要修正 二,一个例子: package com.example.okdemo1.activity import android.o 阅读全文
posted @ 2025-06-02 12:27
刘宏缔的架构森林
阅读(171)
评论(0)
推荐(0)
摘要:
一,安装第三方库 官方地址: https://mvnrepository.com/artifact/com.github.hackware1993/MagicIndicator 编辑 build.gradle,添加: // https://mvnrepository.com/artifact/com 阅读全文
posted @ 2025-06-02 12:27
刘宏缔的架构森林
阅读(186)
评论(0)
推荐(0)
摘要:
一,报错信息 * What went wrong: Execution failed for task ':app:mergeDebugNativeLibs'. > Could not resolve all files for configuration ':app:debugRuntimeCla 阅读全文
posted @ 2025-06-02 12:27
刘宏缔的架构森林
阅读(504)
评论(0)
推荐(0)
摘要:
一,代码 activity xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/ 阅读全文
posted @ 2025-06-02 12:27
刘宏缔的架构森林
阅读(12)
评论(0)
推荐(0)
摘要:
一,代码: activity xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com 阅读全文
posted @ 2025-06-02 12:27
刘宏缔的架构森林
阅读(30)
评论(0)
推荐(0)
摘要:
一,报错信息: 错误: 对于add(int,MsgFragment), 找不到合适的方法 fragmentTransaction.add(R.id.fragment_container, fragment); ^ 方法 FragmentTransaction.add(Fragment,String) 阅读全文
posted @ 2025-06-02 12:27
刘宏缔的架构森林
阅读(28)
评论(0)
推荐(0)
摘要:
一,创建common目录 然后在common目录下创建layout目录 二,原来在layout目录下的xml需要另放一个目录 我们创建一个main目录,main目录下创建layout,移动到这里 三,在build.gradle中添加已创建目录: //在layout文件夹下建立子文件夹 sourceS 阅读全文
posted @ 2025-06-02 12:27
刘宏缔的架构森林
阅读(77)
评论(0)
推荐(0)
摘要:
一,代码: 公用部分 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertic 阅读全文
posted @ 2025-06-02 12:23
刘宏缔的架构森林
阅读(11)
评论(0)
推荐(0)
摘要:
一,代码: activity xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com 阅读全文
posted @ 2025-06-02 12:23
刘宏缔的架构森林
阅读(35)
评论(0)
推荐(0)
摘要:
一,代码: activity的xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com 阅读全文
posted @ 2025-06-02 12:22
刘宏缔的架构森林
阅读(182)
评论(0)
推荐(0)
摘要:
一,代码: activity xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com 阅读全文
posted @ 2025-06-02 12:22
刘宏缔的架构森林
阅读(62)
评论(0)
推荐(0)
摘要:
一,代码: 说明:在外层的最上面,增加了固定不移动的header xml: <?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http: 阅读全文
posted @ 2025-06-02 12:22
刘宏缔的架构森林
阅读(192)
评论(0)
推荐(0)
摘要:
一,NestedScrollView与ScrollView的区别: NestedScrollView 和 ScrollView 的主要区别在于它具备“嵌套滑动”(Nested Scrolling)功能。在 Android 中,嵌套滑动是一种滚动冲突处理机制,允许父视图和子视图协同工作,共同处理滑动事 阅读全文
posted @ 2025-06-02 12:22
刘宏缔的架构森林
阅读(162)
评论(0)
推荐(0)
摘要:
一,代码: xml: activity <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.co 阅读全文
posted @ 2025-06-02 12:22
刘宏缔的架构森林
阅读(59)
评论(0)
推荐(0)
摘要:
一,代码: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/andr 阅读全文
posted @ 2025-06-02 12:22
刘宏缔的架构森林
阅读(26)
评论(0)
推荐(0)
摘要:
一,fragment生命周期以及和activity生命周期的关系 和activity生命周期的关系 二,代码: viewpager2的两个fragment cate1 package com.example.okdemo1.fragment; import android.app.Activity; 阅读全文
posted @ 2025-06-02 12:22
刘宏缔的架构森林
阅读(45)
评论(0)
推荐(0)
浙公网安备 33010602011771号