-
Notifications
You must be signed in to change notification settings - Fork 217
Styles_en
In addition to the default Material theme, users can choose to introduce other themes.
Each theme comes with light/dark modes, which can be switched through DialogX's light and dark mode setting properties. The change takes effect when the next dialog opens.
Choose one of the following four methods.
- In the project's build.gradle file, find the
allprojects{}
block and add the following code:
allprojects {
repositories {
google()
mavenCentral() // Add mavenCentral repository
}
}
- In the app's build.gradle file, find the
dependencies{}
block, and add the following statement:
// Please modify to use the latest version of DialogX
def dialogx_version = "0.0.49"
// Add corresponding package files as needed, please keep the dialogx_version version number consistent with the DialogX main library you are using
implementation "com.kongzue.dialogx.style:DialogXIOSStyle:${dialogx_version}"
implementation "com.kongzue.dialogx.style:DialogXKongzueStyle:${dialogx_version}"
implementation "com.kongzue.dialogx.style:DialogXMIUIStyle:${dialogx_version}"
implementation "com.kongzue.dialogx.style:DialogXMaterialYouStyle:${dialogx_version}"
- In the project's build.gradle file, find the
allprojects{}
block and add the following code:
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' } // Add jitPack Maven repository
}
}
- In the app's build.gradle file, find the
dependencies{}
block, and add the following statement:
// Please modify to use the latest version of DialogX
def dialogx_version = "0.0.49"
// Add corresponding package files as needed, please keep the dialogx_version version number consistent with the DialogX main library you are using
implementation "com.github.kongzue.DialogX:DialogXIOSStyle:${dialogx_version}"
implementation "com.github.kongzue.DialogX:DialogXKongzueStyle:${dialogx_version}"
implementation "com.github.kongzue.DialogX:DialogXMIUIStyle:${dialogx_version}"
implementation "com.github.kongzue.DialogX:DialogXMaterialYou:${dialogx_version}"
- In the project's build.gradle file, find the
allprojects{}
block and add the following code:
allprojects {
repositories {
google()
jcenter()
maven{
url 'https://dl.bintray.com/myzchh/maven'
}
}
}
- In the app's build.gradle file, find the
dependencies{}
block, and add the following statement:
dependencies {
// Add corresponding package files as needed
implementation 'com.github.kongzue.DialogX:DialogXIOSStyle:latest.release'
implementation 'com.github.kongzue.DialogX:DialogXKongzueStyle:latest.release'
implementation 'com.github.kongzue.DialogX
:DialogXMIUIStyle:latest.release'
implementation 'com.github.kongzue.DialogX:DialogXMaterialYou:latest.release'
...
}
Please visit the Release page to download AAR package files for the needed theme and version.
-
Place the AAR in the libs directory.
-
Add the following code in the Module's build.gradle:
repositories{
flatDir {
dirs 'libs'
}
}
implementation(name: 'AAR file name', ext: 'aar')
Sync Gradle, and then set DialogX in the code. Generally, we recommend placing it in the onCreate
method of the Application:
// Set to IOS theme
DialogX.globalStyle = new IOSStyle();
// Set to Kongzue theme
DialogX.globalStyle = new KongzueStyle();
// Set to MIUI theme
DialogX.globalStyle = new MIUIStyle();
// Set to MaterialYou theme
DialogX.globalStyle = new MaterialYouStyle();
Launch the dialog, and you can see the corresponding style.