Skip to content

Styles_en

Kongzue edited this page Nov 16, 2023 · 1 revision

🌐 View 简体中文文档 | 繁體中文文檔

👔 Using Other DialogX Themes

Using Other DialogX Themes

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.

iOS Theme Style

iOS Theme

Kongzue Theme Style

Kongzue Theme

MIUI Theme Style

MIUI Theme

How to Use

Choose one of the following four methods.

Method 1: Using MavenCentral Source

Latest Version: DialogX Release
  1. In the project's build.gradle file, find the allprojects{} block and add the following code:
allprojects {
    repositories {
        google()
        mavenCentral()      // Add mavenCentral repository
    }
}

⚠️Note: For projects created using Android Studio Arctic Fox, you need to go to settings.gradle to add the above jitpack repository configuration.

  1. 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}"

Method 2: Using jitPack Source

Latest Version: Jitpack.io
  1. 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
    }
}
  1. 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}"

Method 3: Using jCenter Source

⚠️Warning: jCenter has ceased operations!

  1. 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'
        }
    }
}
  1. 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'
    ...
}

Method 4: Directly Importing AAR Theme Packages

Please visit the Release page to download AAR package files for the needed theme and version.

  1. Place the AAR in the libs directory.

  2. Add the following code in the Module's build.gradle:

repositories{
    flatDir {
        dirs 'libs'
    }
}

implementation(name: 'AAR file name', ext: 'aar')

Usage

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.

Clone this wiki locally