下拉框spinner

repositories {
flatDir {
dirs 'libs' //就是你放aar的目录地址
maven { url "https://jitpack.io" }
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

compile 'com.github.arcadefire:nice-spinner:1.3.1'
}

xml中
<org.angmarch.views.NiceSpinner

android:id="@+id/spinner1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="1dp"/>

spinner1.attachDataSource(list1_yuzhong);
spinner1.addOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String name = list1_yuzhong.get(position).toString();//点击的条目



 

猜你喜欢

转载自www.cnblogs.com/leshen/p/9098658.html