如何使用导航架构组件 safeargs 将参数传递给对话框片段?下面是我当前的实现
开始片段
val navController = findNavController()
val action =
QuestionListFragmentDirections.actionQuestionListFragmentToCustomDialogFragment(args.templateFlag)
navController.navigate(
action
)
Run Code Online (Sandbox Code Playgroud)
目的地片段
args.templateFlage //supposed to return a boolean value
//but throws java.lang.IllegalStateException: Fragment QuestionTypeDialogFragment{e8be5e1}
(47b305ea-35b2-49e0-b378-d31a08ba9a41) QuestionTypeDialogFragment} has null arguments
Run Code Online (Sandbox Code Playgroud) 我想使用AndroidX库,下面是Butterknife的Gradle设置
app:模块依赖
implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
Run Code Online (Sandbox Code Playgroud)
插入
apply plugin: 'com.jakewharton.butterknife'
项目依赖
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha09'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Run Code Online (Sandbox Code Playgroud)
项目存储库
repositories {
google()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
jcenter()
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试设置我的SettingsFragment,但是
import PreferenceFragmentCompat 没工作。
使用AndroidX可以做到这一点吗?
相依性
implementation 'androidx.preference:preference:1.0.0-rc02'
Run Code Online (Sandbox Code Playgroud)
摇篮飞行
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.idealorb.payrollapp"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
android.defaultConfig.vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0-rc02'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-rc02'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-rc01'
implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha05'
implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha05'
implementation 'androidx.preference:preference:1.0.0-rc02'
testImplementation 'junit:junit:4.12' …Run Code Online (Sandbox Code Playgroud)