赞
踩
每过一段时间呀,我都会给大家带来一些从Github上收集的一些开源库,有的是炫酷动效,有的则是实用的工具和类库。以前没看过或者没有收藏的同学,建议先收藏,以下是链接:
【Android珍藏】推荐10个炫酷的开源库
【开源推荐】进阶实战,从一款音乐播放器开始
2020年有哪些优秀的开源库呢?本期就为大家带精选的10个,排名不分先后。
这是一个很棒的ViewPager库,它在浏览ViewPager的不同页面时,显示波浪的滑动动画,效果非常炫酷。该库的USP是触摸交互的。这意味着在视图中显示类似液体的显示过渡时,应考虑触摸事件。
导入以下Gradle依赖项:
implementation 'com.github.Chrisvin:LiquidSwipe:1.3'
然后将LiquidSwipeLayout
添加为保存fragment布局的容器的根布局:
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.jem.liquidswipe.LiquidSwipeViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
效果1 | 效果2 |
---|---|
更多详细使用方法请看Github: https://github.com/Chrisvin/LiquidSwipe
Flourish
提供了一个炫酷的方式来显示或者隐藏一个布局,实现方式也很简单,就是对View或者布局进行了包装,通过构建者模式来提供api给上层调用。就像使用dialog一样,调用show
和dissmiss
方法来显示和隐藏。此外,通过这些类,我们还可以自定义动画(正常,加速,反弹),或为布局方向设置我们自己的起点(左上,右下等)。
在build.gradle 中添加如下依赖:
dependencies {
implementation "com.github.skydoves:flourish:1.0.0"
}
然后在代码中,构建布局:
Flourish flourish = new Flourish.Builder(parentLayout)
// sets the flourish layout for showing and dismissing on the parent layout.
.setFlourishLayout(R.layout.layout_flourish_main)
// sets the flourishing animation for showing and dismissing.
.setFlourishAnimation(FlourishAnimation.BOUNCE)
// sets the orientation of the starting point.
.setFlourishOrientation(FlourishOrientation.TOP_LEFT)
// sets a flourishListener for listening changes.
.setFlourishListener(flourishListener)
// sets the flourish layout should be showed on start.
.setIsShowedOnStart(false)
// sets the duration of the flourishing.
.setDuration(800L)
.build();
还提供有更简介的DSL:
val myFlourish = createFlourish(parentLayout) {
setFlourishLayout(R.layout.layout_flourish_main)
setFlourishAnimation(FlourishAnimation.ACCELERATE)
setFlourishOrientation(FlourishOrientation.TOP_RIGHT)
setIsShowedOnStart(true)
setFlourishListener {
}
}
效果1 | 效果2 |
---|---|
更多详细使用请看Github:https://github.com/skydoves/Flourish
这是一个美观而时尚的AlterDialog库,目前可支持六种不同的对话框,如:
在build.gradle
中添加如下依赖:
dependencies {
...
implementation 'com.github.gabriel-TheCode:AestheticDialogs:1.1.0'
}
代码中,显示不同种类的对话框则调用对应的方法就好
Flash:
AestheticDialog.showFlashDialog(this, "Your dialog Title", "Your message", AestheticDialog.SUCCESS);
AestheticDialog.showFlashDialog(this, "Your dialog Title", "Your message", AestheticDialog.ERROR);
Connectify:
AestheticDialog.showConnectify(this,"Your message", AestheticDialog.SUCCESS);
AestheticDialog.showConnectify(this, "Your message", AestheticDialog.ERROR);
/// Dark Theme
AestheticDialog.showConnectifyDark(this,"Your message",AestheticDialog.SUCCESS);
AestheticDialog.showConnectifyDark(this, "Your message", AestheticDialog.ERROR);
Toaster:
AestheticDialog.showToaster(this, "Your dialog Title", "Your message", AestheticDialog.ERROR);
AestheticDialog.showToaster(this, "Your dialog Title", "Your message", AestheticDialog.SUCCESS);
AestheticDialog.showToaster(this, "Your dialog Title", "Your message", AestheticDialog.WARNING);
AestheticDialog.showToaster(this, "Your dialog Title", "Your message", AestheticDialog.INFO);
/// Dark Theme
AestheticDialog.showToasterDark(this, "Your dialog Title", "Your message", AestheticDialog.ERROR);
AestheticDialog.showToasterDark(this, "Your dialog Title", "Your message", AestheticDialog.SUCCESS);
AestheticDialog.showToasterDark(
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。