alguojian/android-WheelView


仿ios实现wheelVIew,可以用于实现三级联动等效果

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.alguojian:android-wheelview:1.2'
	}
	dependencies {
		implementation("com.github.alguojian:android-wheelview:1.2")
	}
	<dependency>
	    <groupId>com.github.alguojian</groupId>
	    <artifactId>android-wheelview</artifactId>
	    <version>1.2</version>
	</dependency>

                            
    libraryDependencies += "com.github.alguojian" % "android-wheelview" % "1.2"
        
        

                            
    :dependencies [[com.github.alguojian/android-wheelview "1.2"]]
        
        

Readme


仿照ios实现的wheelView,方便实现三极联动等城市选择,时间选择等效果

1.Add it in your root build.gradle at the end of repositories:

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

2.Add the dependency

dependencies {
	         compile 'com.github.ALguojian:android-WheelVIew:v1.2'
	}

点此下载APK

或者扫码下载

WheelView

|属性|说明| |-|-| |wheelview.setData()|设置数据| |wheelview.setDefault()|设置默认显示第几个| |setOnSelectListener|设置滑动监听|

|XML属性|说明| |-|-| |app:itemNumber|显示个数| |app:lineColor="#ffff00"|分割线颜色| |app:normalTextColor="#555"|默认颜色| |app:selectedTextColor="#57caa1"|选中颜色| |app:selectedTextSize="22sp"|字体大小|

更多用法如下所示:

布局如下

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="test.expmle.com.fang.Main2Activity">

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="200dp"
        android:layout_marginTop="8dp"
        android:orientation="horizontal"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <test.expmle.com.alguojianwheelview.WheelView
            android:layout_width="0dp"
            android:id="@+id/one"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            app:itemNumber="3"
            app:lineColor="#cccccc"
            app:lineHeight="1.5dp"
            app:maskHight="32dp"
            app:noEmpty="true"
            app:normalTextColor="#777"
            app:normalTextSize="14sp"
            app:selectedTextColor="#ff000000"
            app:selectedTextSize="22sp"
            app:unitHight="50dp" />

        <test.expmle.com.alguojianwheelview.WheelView
            android:layout_width="0dp"
            android:id="@+id/two"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            app:itemNumber="3"
            app:lineColor="#cccccc"
            app:lineHeight="1.5dp"
            app:maskHight="32dp"
            app:noEmpty="true"
            app:normalTextColor="#777"
            app:normalTextSize="14sp"
            app:selectedTextColor="#ff000000"
            app:selectedTextSize="22sp"
            app:unitHight="50dp" />

        <test.expmle.com.alguojianwheelview.WheelView
            android:layout_width="0dp"
            android:id="@+id/three"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            app:itemNumber="3"
            app:lineColor="#cccccc"
            app:lineHeight="1.5dp"
            app:maskHight="32dp"
            app:noEmpty="true"
            app:normalTextColor="#777"
            app:normalTextSize="14sp"
            app:selectedTextColor="#ff000000"
            app:selectedTextSize="22sp"
            app:unitHight="50dp" />

    </LinearLayout>

</android.support.constraint.ConstraintLayout>