我常用的Android库

Android官方

1
2
3
4
5
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'

我的常用组件

Kotlin

Kotlin & anko

anko

project - build.gradle

1
2
3
4
5
6
7
8
buildscript {
ext.kotlin_version = '1.1.51'
//....
dependencies {
//...
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

app - build.gradle

1
2
3
4
5
6
7
8
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "org.jetbrains.anko:anko-commons:0.10.4"
}

UI

UI框架

QMUI https://qmuiteam.com/android

1
implementation 'com.qmuiteam:qmui:2.0.0-alpha02'

图片圆角&背景圆角

图片圆角RoundedImageView

背景圆角FlycoRoundView

1
2
3
4
//图片圆角
implementation 'com.makeramen:roundedimageview:2.3.0'
//背景圆角
implementation 'com.flyco.roundview:FlycoRoundView_Lib:1.1.4@aar'

消息提示

Toasty

1
implementation 'com.github.GrenderG:Toasty:1.2.8'

弹出窗口

Material Dialogs

1
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'

圆状进度

CircleProgressBar

1
2
//圆状进度
implementation 'com.dinuscxj:circleprogressbar:1.1.1'

Github:https://github.com/youth5201314/banner

1
implementation 'com.youth.banner:banner:2.0.11'

BGABanner-Android

1
2
//Banner
implementation 'cn.bingoogolapple:bga-banner:2.2.4@aar'

标签云

TagCloudView

1
2
//标签云
implementation 'com.github.kingideayou:tagcloudview:1.0.2'

多条件筛选菜单

DropDownMenu

1
2
3
4
5
6
7
8
9
10
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}

dependencies {
compile 'com.github.dongjunkun:DropDownMenu:1.0.4'
}

仿iOS Segment

SHSegmentControl

1
implementation 'com.7heaven.widgets:segmentcontrol:1.17'

加载HTML的TextView

html-textview

1
2
3
dependencies {
implementation 'org.sufficientlysecure:html-textview:3.5'
}

自定义弹出层

CustomPopwindow

1
2
3
4
5
6
7
8
9
10
11
allprojects {
epositories {
//...
maven {
url 'https://jitpack.io'
}
}

dependencies {
compile 'com.github.pinguo-zhouwei:CustomPopwindow:2.1.1'
}

MaterialDialog

设置主题

1
2
3
4
5
6
7
8
9
MaterialDialog.Builder(mContext)
.title("温馨提示")
.theme(Theme.LIGHT)
.content("您确定要删除吗?")
.positiveText("确认")
.negativeText("取消")
.onPositive { dialog, which ->
}
.show()

不设置主题的话,在不同的系统下有的是亮色有的是暗色

设置自定义View

1
2
3
4
5
6
7
8
9
10
11
12
dialog = MaterialDialog.Builder(this)
.theme(Theme.LIGHT)
.title("加入群")
.customView(R.layout.s_dialog_input, true)
.positiveText("加入")
.negativeText("取消")
.onPositive { dialog, which ->

}
.show()

(dialog?.findViewById(R.id.input_edittext) as EditText).hint = "请输入要加入的群号"

功能

权限

Adapter

BaseRecyclerViewAdapterHelper

1
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'

RX

RxAndroid

1
2
3
4
5
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.10'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'
implementation 'com.trello.rxlifecycle2:rxlifecycle:2.2.1'
implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.1'

网络请求

Retrofit+RX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//okhttp3
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation "com.squareup.okhttp3:logging-interceptor:3.10.0"
//retrofit2
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
//rxjava2
implementation "io.reactivex.rxjava2:rxjava:2.1.12"
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
//AutoDispose解决RxJava内存泄漏
implementation 'com.uber.autodispose:autodispose:0.7.0'
implementation 'com.uber.autodispose:autodispose-android:0.7.0'
implementation 'com.uber.autodispose:autodispose-android-archcomponents:0.7.0'

OkGo+FastJson

  • okhttp-OkGo

  • fastjson

    1
    2
    3
    4
    5
    //网络请求
    implementation 'com.lzy.net:okgo:3.0.4'
    implementation 'com.lzy.net:okrx2:2.0.2'
    //JSON
    implementation 'com.alibaba:fastjson:1.2.46'

数据库

android-lite-orm

1
引用Jar包

事件总线

EventBus

1
implementation 'org.greenrobot:eventbus:3.0.0'

图片加载

Glide OR glide-transformations 选其一

Glide

1
2
//Glide
implementation 'com.github.bumptech.glide:glide:3.7.0'

glide-transformations

1
2
3
//glide-transformations
implementation 'jp.wasabeef:glide-transformations:3.1.1'
implementation 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'

Gif加载

android-gif-drawable

1
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'

事件视图绑定

Kotlin项目不建议再使用

1
2
> implementation "org.jetbrains.anko:anko:$anko_version"
>

可以使用Anko代替

Butterknife

1
2
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

如果编程语言为Kotlin, 替换 annotationProcessorkapt

应用崩溃检测服务

Bugly

1
compile 'com.tencent.bugly:crashreport:latest.release'

其他

GitHub上受欢迎的Android UI Library