0
点赞
收藏
分享

微信扫一扫

XUI 集成指南

allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}


切记不要跳过这一步,因为XUI目前只发布在​​jitpack​​​平台上,跳过这一步会导致​​ERROR: Failed to resolve: com.github.xuexiangjys:XUI:x.x.x​​错误!!!


在dependencies添加:

dependencies {
...
//androidx项目
implementation 'com.github.xuexiangjys:XUI:1.1.5'

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
}

如果你的项目目前还未使用androidx,请使用如下配置:

dependencies {
...
//support项目
implementation 'com.github.xuexiangjys:XUI:1.0.9-support'

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
}

在Application最顶部初始化设置(必须)


XUI.init(this); //初始化UI框架
XUI.debug(true); //开启UI框架调试日志

基础主题类型:

大平板(10英寸, 240dpi, 1920*1200):XUITheme.Tablet.Big

小平板(7英寸, 320dpi, 1920*1200):XUITheme.Tablet.Small

手机(4.5英寸, 320dpi, 720*1280):XUITheme.Phone

<style name="AppTheme" parent="XUITheme.Phone">

<!-- 自定义自己的主题样式 -->

<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>

</style>

当然也可以在Activity刚开始时调用如下代码动态设置主题





举报

相关推荐

0 条评论