适配中英文切换
This commit is contained in:
@@ -1,10 +1,20 @@
|
||||
package com.example.defenseapplication
|
||||
|
||||
import android.app.Application
|
||||
import com.blankj.utilcode.util.Utils;
|
||||
class MyApplication : Application(){
|
||||
import android.content.Context
|
||||
import com.blankj.utilcode.util.Utils
|
||||
import com.example.defenseapplication.utils.LanguageUtil
|
||||
|
||||
class MyApplication : Application() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
Utils.init(this) // 初始化 AndroidUtilCode
|
||||
}
|
||||
}
|
||||
|
||||
override fun attachBaseContext(base: Context) {
|
||||
// 在应用启动时应用语言设置
|
||||
val context = LanguageUtil.attachBaseContext(base)
|
||||
super.attachBaseContext(context)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user