WheelView - 创建轮子的Android UI库

Android UI library to create wheels

Android 其它控件

访问GitHub主页

共111Star

详细介绍

WheelView

Android UI library to create wheels

License: GPL v3 API

     
ANIMATE_TO_ANCHOR              STATIC

Usage

Set up the dependency

  1. Add the JitPack repository to your root build.gradle at the end of repositories:
allprojects {  
   repositories {  
      ...  
      maven { url 'https://jitpack.io' }  
   }  
}  
  1. Add dependency in the build.gradle:
implementation 'com.github.psuzn:WheelView:0.1.0'  

Use a WheelView in your layout.

<me.sujanpoudel.wheelview.WheelView
    android:id="@+id/wheel_view"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_margin="16dp"
    app:anchorAngle="270"
    app:centerIconPadding="16dp"
    app:centerIconTint="#FFF"
    app:mode="ANIMATE_TO_ANCHOR"
    app:selectedArcBackgroundColor="#FE6447"
    app:startAngle="315"
    app:textSize="16sp" />

Setup arc titles

...
setContentView(R.layout.activity_main)  
val wheelView = findViewById<WheelView>(R.id.wheel_view)  
wheelView.titles = listOf("First", "Second", "Third", "Fourth")
...

Customization

You can customize following properties:



<me.sujanpoudel.wheelview.WheelView  
  android:id="@+id/wheel_view"  
  android:layout_width="match_parent"  
  android:layout_height="match_parent"  
  android:layout_margin="16dp"  
  
  app:dividerStrokeWidth="16dp"  
  app:arcBackgroundColor="#F7F8FB"  
  app:selectedArcBackgroundColor="#FE6447"  
  app:centerIcon="@drawable/ic_baseline_add_24"  
  app:centerIconPadding="16dp"  
  app:centerIconTint="@color/white"  
  app:anchorAngle="45"  
  app:startAngle="315"  
  app:textSize="16sp"  
  app:selectedTextColor="#FFF"  
  app:textColor="#000000"  
  app:animationDuration="500"  
  app:mode="ANIMATE_TO_ANCHOR|STATIC"  
  />
1. Wheel Mode

The WheelView has two modes

enum class Mode {  
    ANIMATE_TO_ANCHOR,  // the selected arc segment animates and moves to anchor angle like  
    STATIC  // only the selected 
}
1. Arc Segment Divider Stroke Width
<me.sujanpoudel.wheelview.WheelView
    app:dividerStrokeWidth="16dp" 
    ...
2. Arc Segment Background Color
<me.sujanpoudel.wheelview.WheelView
  app:arcBackgroundColor="#F7F8FB"  
  app:selectedArcBackgroundColor="#FE6447"  
  ...
3. Center Icon
<me.sujanpoudel.wheelview.WheelView
  app:centerIcon="@drawable/ic_baseline_add_24"  
  app:centerIconPadding="16dp"  
  app:centerIconTint="@color/white"  
  ...
4. Mode, Angle and Animation
<me.sujanpoudel.wheelview.WheelView
  app:anchorAngle="45"  
  app:startAngle="315"   
  app:mode="ANIMATE_TO_ANCHOR|STATIC" 
  app:animationDuration="500"   
  ...
4. Text
<me.sujanpoudel.wheelview.WheelView
 app:textSize="16sp"  
 app:selectedTextColor="#FFF"  
 app:textColor="#000000"    
  ...

Bugs and Feedback

For bugs, questions and discussions please use the Github Issues.

License

GPL V3 License  
  
Copyright (c) 2019 psuzn 
  
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>. 
推荐源码