1. 程式人生 > >下拉框spinner

下拉框spinner

AD jar com 技術分享 pac ESS pan height OS

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();//點擊的條目

技術分享圖片

 

下拉框spinner