主题和Button背景颜色冲突
修改themes.xml:
<style name="Theme.UICustomViews" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge">
在RycyclerView中,点击事件写在onCreateViewHolder()中时,异常index=-1
将点击事件写在ViewHolder中的init结构体中。
平分ConstrainLayout
android:layout_width="0dp"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintEnd_toStartOf="@+id/rightFrag"
SQLite中cursor.getString(cursor.getColumnIndex("name"))报错,Value must be ≥ 0
声明变量后再赋值:
val index1 = cursor.getColumnIndex("name")
val name = cursor.getString(index1)
从相册中选择照片时,无法选择照片
val intent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
startActivityForResult(intent, fromAlbum)
错误:Gradle sync failed: Could not create parent directory for lock file
选择Preferences - Gradle, 去掉(gradle user home )后的路径
错误:Runtime JAR files in the classpath should have the same version.
在build.gradle(Project)文件中更改Kotlin版本:
ext.kotlin_version = "1.7.20"
运行程序,模拟器白板,什么都没有
升级插件。
Duplicate class found
在gradle.properties文件中设置:
android.enableJetifier=true
Unresolved reference: Parcelize
添加插件:
plugins { id 'kotlin-android-extensions' }