Room数据库Schema export Error

在使用Android Room数据库的时候报错了:Schema export directory is not provided to the annotation processor so we cannot export the schema. You can either provide `room.schemaLocation` annotation processor argument OR set exportSchema to false.如果您不需要检查架构并且想要摆脱警告,只需将exportSchema = false添加到RoomDatabase中,如下所示:@Dat...

默认分类,android 2021-04-02 PM 13℃ 0条

改变状态栏文本颜色(WHITE/BLACK)

API> = 23从API v23及更高版本开始,可以将以下内容添加到AppTheme styles.xml中:解决方案1// View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR: 将状态栏的文字设置为黑色 window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR解决方案1<item name="android:statusBarColor">@color/colorPrimaryDark</item> <item na...

默认分类,android 2021-03-29 AM 12℃ 0条

java里的static代码块怎么转成对应的kotline代码?

JAVA:class Test { static { // 启动时执行的代码 } }Kotlin:companion object { init { // 启动时执行的代码 } }

默认分类,android 2021-03-25 AM 14℃ 0条

onActivityResult过时了,registerForActivityResult使用方法

最常用的写法registerForActivityResult( ActivityResultContracts.StartActivityForResult() ) { result -> val data = result.data val resultCode= result.resultCode val extra = data?.getStringExtra("extra") }.launch(Intent(this, Mai...

默认分类,android 2021-03-25 AM 28℃ 0条

Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation

android 8.0 (API=26) 出现的问题解决方法:去掉android:screenOrientation;android:windowIsTranslucent 改为false; 如果需要透明的设置加上android:windowDisablePreview =true;在项目res目录下创建values-v26/styles.xml<?xml version="1.0" encoding="utf-8"?> <resources> <style name="AppTheme.Start&...

默认分类,android 2021-02-23 AM 32℃ 0条