Convert Figma logo to code with AI

Ramotion logofluid-slider-android

:octocat:💧 A slider widget with a popup bubble displaying the precise value selected. Android library made by @Ramotion

1,424
148
1,424
5

Top Related Projects

A custom SeekBar on Android, which can be changed the size ,color , thumb drawable , tick drawable , tick text and indicator , also , will show an indicator view with progress above SeekBar when seeking. https://github.com/warkiz/IndicatorSeekBar

 A beautiful and powerful SeekBar what supports single、 range、steps、vetical、custom( 一款美观强大的支持单向、双向范围选择、分步、垂直、高度自定义的SeekBar)

Quick Overview

Fluid-slider-android is an Android library that provides a custom slider UI component with a fluid animation effect. It offers a visually appealing and interactive way for users to select values within a range, enhancing the user experience in Android applications.

Pros

  • Smooth and visually appealing fluid animation
  • Customizable appearance and behavior
  • Easy integration into existing Android projects
  • Supports both Java and Kotlin

Cons

  • Limited to Android platform only
  • May require additional performance optimization for low-end devices
  • Learning curve for customizing advanced features
  • Dependency on external libraries

Code Examples

  1. Basic implementation of Fluid Slider:
val slider = findViewById<FluidSlider>(R.id.fluidSlider)
slider.positionListener = { pos -> Log.d("Slider", "Current position: $pos") }
slider.beginTrackingListener = { Log.d("Slider", "Began tracking") }
slider.endTrackingListener = { Log.d("Slider", "Ended tracking") }
  1. Customizing the appearance:
slider.bubbleText = "50%"
slider.colorBar = ContextCompat.getColor(this, R.color.colorPrimary)
slider.colorBubble = ContextCompat.getColor(this, R.color.colorAccent)
slider.textSize = 14f
  1. Setting min and max values:
slider.position = 0.5f
slider.startText = "0"
slider.endText = "100"

Getting Started

  1. Add the JitPack repository to your project's build.gradle file:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency to your app's build.gradle file:
dependencies {
    implementation 'com.github.Ramotion:fluid-slider-android:0.3.1'
}
  1. Add the FluidSlider to your layout XML:
<com.ramotion.fluidslider.FluidSlider
    android:id="@+id/fluidSlider"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />
  1. Initialize and use the slider in your Activity or Fragment:
val slider = findViewById<FluidSlider>(R.id.fluidSlider)
slider.positionListener = { pos -> 
    // Handle position changes
}

Competitor Comparisons

A custom SeekBar on Android, which can be changed the size ,color , thumb drawable , tick drawable , tick text and indicator , also , will show an indicator view with progress above SeekBar when seeking. https://github.com/warkiz/IndicatorSeekBar

Pros of IndicatorSeekBar

  • More customization options for the indicator and thumb
  • Supports both horizontal and vertical orientations
  • Offers a wider range of styles and designs out of the box

Cons of IndicatorSeekBar

  • Less fluid animation compared to fluid-slider-android
  • May require more setup code for advanced customizations
  • Lacks the unique bubble-like slider design of fluid-slider-android

Code Comparison

IndicatorSeekBar:

val seekBar = IndicatorSeekBar.Builder(this)
    .setMax(100)
    .setMin(0)
    .setProgress(50)
    .setIndicatorColor(Color.RED)
    .build()

fluid-slider-android:

val slider = FluidSlider(context)
slider.positionListener = { pos -> Log.d("Position", pos.toString()) }
slider.position = 0.3f
slider.startText ="0"
slider.endText = "100"

Both libraries offer easy-to-use APIs for creating customizable sliders, but IndicatorSeekBar provides more granular control over individual components. fluid-slider-android focuses on a specific design aesthetic with smoother animations. The choice between the two depends on the desired visual style and level of customization needed for the project.

Pros of discreteSeekBar

  • Simpler implementation, easier to integrate into existing projects
  • Supports both continuous and discrete (stepped) seek bar modes
  • Customizable appearance with various attributes

Cons of discreteSeekBar

  • Less visually appealing compared to fluid-slider-android's modern design
  • Limited animation options and visual feedback
  • Lacks advanced features like bubble indicators or custom thumb designs

Code Comparison

discreteSeekBar:

<org.adw.library.widgets.discreteseekbar.DiscreteSeekBar
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:dsb_min="0"
    app:dsb_max="100"
    app:dsb_value="50" />

fluid-slider-android:

<com.ramotion.fluidslider.FluidSlider
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:bar_color="#ffffff"
    app:bubble_color="#ff0000"
    app:size="small" />

Both libraries provide custom seek bar implementations for Android, but fluid-slider-android offers a more modern and visually appealing design with advanced features like animated bubble indicators. discreteSeekBar, on the other hand, provides a simpler implementation with support for both continuous and discrete modes, making it easier to integrate into existing projects. The choice between the two depends on the specific requirements of your app, such as design preferences and desired functionality.

 A beautiful and powerful SeekBar what supports single、 range、steps、vetical、custom( 一款美观强大的支持单向、双向范围选择、分步、垂直、高度自定义的SeekBar)

Pros of RangeSeekBar

  • Supports both single and range selection modes
  • Offers more customization options for appearance and behavior
  • Provides built-in support for step values and tick marks

Cons of RangeSeekBar

  • Less visually appealing default design compared to fluid-slider-android
  • May require more setup and configuration to achieve desired look and feel
  • Lacks the smooth, fluid animation present in fluid-slider-android

Code Comparison

RangeSeekBar implementation:

<com.jaygoo.widget.RangeSeekBar
    android:id="@+id/rangeSeekBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:rsb_mode="range"
    app:rsb_min="0"
    app:rsb_max="100" />

fluid-slider-android implementation:

<com.ramotion.fluidslider.FluidSlider
    android:id="@+id/fluidSlider"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:bar_color="@color/colorPrimary"
    app:bubble_color="@color/colorAccent" />

Both libraries offer easy-to-use XML implementations, but RangeSeekBar provides more attributes for customization out of the box. fluid-slider-android focuses on a sleek, minimalist design with fewer initial configuration options.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

FLUID SLIDER [KOTLIN]

A slider widget with a popup bubble displaying the precise value selected


We specialize in the designing and coding of custom UI for Mobile Apps and Websites.

Stay tuned for the latest updates:

Inspired by Virgil Pana shot


Twitter Codacy Badge Donate

Requirements

  • Android 4.1 Jelly Bean (API lvl 16) or greater
  • Your favorite IDE

Installation

​ 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>

Basic usage

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.

Third Party Bindings

React Native

You may now use this library with React Native via the module here

🗂 Check this library on other language:

📄 License

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

📱 Get the Showroom App for Android to give it a try

Try this UI component and more like this in our Android app. Contact us if interested.