Inspired by Virgil Pana shot
Just download the package from here and add it to your project classpath, or just use the maven repo:
Gradle:
implementation 'com.ramotion.fluidslider:fluid-slider:0.3.1'
SBT:
libraryDependencies += "com.ramotion.fluidslider" % "fluid-slider" % "0.3.1"
Maven:
<dependency>
<groupId>com.ramotion.fluidslider</groupId>
<artifactId>fluid-slider</artifactId>
<version>0.3.1</version>
<type>aar</type>
</dependency>
Place the FluidSlider
in your layout.
To track the current position of the slider, set the positionListener
, as shown below:
val slider = findViewById<FluidSlider>(R.id.fluidSlider)
slider.positionListener = { p -> Log.d("MainActivity", "current position is: $p" )}
You can also track the beginning and completion of the movement of the slider, using the following properties:beginTrackingListener
and endTrackingListener
. Example below:
slider.beginTrackingListener = { /* action on slider touched */ }
slider.endTrackingListener = { /* action on slider released */ }
Here is simple example, how to change FluidSlider
range.
// Kotlin
val max = 45
val min = 10
val total = max - min
val slider = findViewById<FluidSlider>(R.id.fluidSlider)
slider.positionListener = { pos -> slider.bubbleText = "${min + (total * pos).toInt()}" }
slider.position = 0.3f
slider.startText ="$min"
slider.endText = "$max"
// Java
final FluidSlider slider = findViewById(R.id.fluidSlider);
slider.setBeginTrackingListener(new Function0<Unit>() {
@Override
public Unit invoke() {
Log.d("D", "setBeginTrackingListener");
return Unit.INSTANCE;
}
});
slider.setEndTrackingListener(new Function0<Unit>() {
@Override
public Unit invoke() {
Log.d("D", "setEndTrackingListener");
return Unit.INSTANCE;
}
});
// Or Java 8 lambda
slider.setPositionListener(pos -> {
final String value = String.valueOf( (int)((1 - pos) * 100) );
slider.setBubbleText(value);
return Unit.INSTANCE;
});
Here are the attributes you can specify through XML or related setters:
bar_color
- Color of slider.bubble_color
- Color of circle "bubble" inside bar.bar_text_color
- Color of start
and end
texts of slider.bubble_text_color
- Color of text inside "bubble".start_text
- Start (left) text of slider.end_text
- End (right) text of slider.text_size
- Text size.duration
- Duration of "bubble" rise in milliseconds.initial_position
- Initial positon of "bubble" in range form 0.0
to 1.0
.size
- Height of slider. Can be small
(40dp) and normal
(56dp).This library is a part of a selection of our best UI open-source projects.
You may now use this library with React Native via the module here
Fluid Slider Android is released under the MIT license.See LICENSE for details.
This library is a part of a selection of our best UI open-source projects
If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com
Try this UI component and more like this in our Android app. Contact us if interested.
其实这个开源框架整理很久了,只是一直放在有道云笔记里面,笔者还有很多写得文章都放在有道云笔记里面,有时间都好好整理一下放出来,本篇文章也会不定期更新,由于整理的开源框架分类都有200多个,所有这次只将1/5的整理出来,后面也会有一篇整理github上比较知名的开源App,敬请期待吧,也希望大家多多关注我。 UI部分 RealtimeBlurView 透明毛玻璃效果 BGASwipeBackLayo
Fluid 可以让你在Mac OS系统的桌面上创建互联网网站的应用图标。
为了解决大数据、AI 等数据密集型应用在云原生计算存储分离场景下,存在的数据访问延时高、联合分析难、多维管理杂等痛点问题,南京大学 PASALab、阿里巴巴、Alluxio 在 2020 年 9 月份联合发起了开源项目 Fluid 。 Fluid 是一款开源的云原生基础架构项目。在计算和存储分离的大背景驱动下,Fluid 的目标是为 AI 与大数据云原生应用提供一层高效便捷的数据抽象,将数据从存储
A plugin that allows multiple input elements to be treated as one when typing. For example, if you have social security number split among three input elements, this plugin would allow the user to cli
Fluid Framework 是一个 TypeScript 库,用于构建分布式实时协作 Web 应用程序。 Fluid Framework 提供: 以客户端为中心的应用程序模型,具有数据持久性,无需自定义服务器代码 具有熟悉的编程模式的分布式数据结构 极低的延迟
Fluid Paint 可以在浏览器上实现油画的绘制效果。
Fluid 是基于 Hexo 框架开发的一款 Material Design 风格的主题。 该主题相较于其他主题的优势: 优雅的颜值,使用 Material Design 风格突出层次感,但又不失简约,让用户能专注于写作; 提供大量定制化配置项,使每个用户使用该主题都能具有独特的样式; 响应式页面,适配手机、平板等设备,包括极端的分辨率都能轻松应对; 主题中少有的整合了 LaTeX 和 merma