项目作者: 5hahryar

项目描述 :
A good looking customizable seekBar for android
高级语言: Kotlin
项目地址: git://github.com/5hahryar/AirBar.git
创建时间: 2020-09-14T18:52:24Z
项目社区:https://github.com/5hahryar/AirBar

开源协议:MIT License

下载


AirBar


Platform
API

Usage

  1. allprojects {
  2. repositories {
  3. ...
  4. maven { url 'https://jitpack.io' }
  5. }
  6. }
  1. dependencies {
  2. implementation 'com.github.5hahryar:AirBar:Tag'
  3. }

Jetpack Compose

  1. setContent {
  2. val airBarController = rememberAirBarController(
  3. 50.0,
  4. isHorizontal = true,
  5. animateProgress = true
  6. )
  7. Column(
  8. modifier = Modifier
  9. .width(150.dp)
  10. .height(80.dp)
  11. ) {
  12. AirBar(
  13. modifier = Modifier.fillMaxSize(),
  14. controller = airBarController,
  15. icon = {
  16. Icon(
  17. painter = painterResource(id = R.drawable.icon),
  18. contentDescription = "icon"
  19. )
  20. },
  21. backgroundColor = colorResource(id = R.color.primary),
  22. valueChanged = { value ->
  23. airBarController.progress = value
  24. }
  25. )
  26. }
  27. }

XML

  1. <com.shahryar.airbar.AirBar
  2. android:id="@+id/airbar"
  3. android:layout_width="70dp"
  4. android:layout_height="200dp"></com.shahryar.airbar.AirBar>

Listener

  1. airbar.setOnProgressChangedListener(object : AirBar.OnProgressChangedListener{
  2. override fun onProgressChanged(airBar: AirBar, progress: Double, percentage: Double) {
  3. //Write your code
  4. }
  5. override fun afterProgressChanged(airBar: AirBar, progress: Double, percentage: Double) {
  6. //Write your code
  7. }
  8. })

Attributes

Attribute Functionality
progressBarFillColor Set color for level indicator
progressBarColor0 Set gradient color for bottom of the view
progressBarColor1 Set gradient color for top of the view
backgroundFillColor Set background color
backgroundCornerRadius Set corner radius
orientation Set orientation
icon Set icon
max Set Maximum value
min Set minimum value

License

AirBar is licensed under MIT license. View LICENSE.