久久99亚洲精品久久频_久久久久久久久久久身材好_日本一区二区免费高清视频_www.九九精品_国产做a爱一级毛片久_国产高潮流白浆啊免费A片动态

18842388900

網站建設 APP開發 小程序

Article/文章

記錄成長點滴 分享您我感悟

您當前位置>首頁 > 知識 > 網站建設

Spinner實現了城市連接選擇

在上一篇文章中,我了解了Spinner的簡單用法。我知道Spinner的數據源通常有兩種形式。

XML文件和數組的方式。這次,主要內容是實現Spinner上省與城市的三級聯動,所以我沒有太多話要說

直接在效果圖上!

03HedW6813.pngRWMA5MLNc0.png

城市信息我把他放在strings.xml文件中,具體沒有給出,信息太大

主要的xml文件如下:

[java]查看plaincopyprint?

Arg0,查看arg1,

Int arg2,long arg3){

provinceId=province_spinner.getSelectedItemPosition();

strProvince=province_spinner.getSelectedItem()

.toString(); //獲取所選內容,這是省的名稱

City_spinner=(Spinner)findViewById(R.id.city_spinner);

如果(真){

System.out.println('省:'

+ province_spinner.getSelectedItem()

.toString()+ provinceId.toString());

County_spinner=(Spinner)findViewById(R.id.county_spinner);

City_spinner=(Spinner)findViewById(R.id.city_spinner);

city_spinner.setPrompt('請選擇城市'); //設置標題

選擇(city_spinner,city_adapter,city [provinceId]); //城市級數據綁定

/*表示該市的省和市的城市收集[provinceId]

* R. Array.beijing */

City_spinner

.setOnItemSelectedListener(new OnItemSelectedListener(){

@override

公共無效onItemSelected(

AdapterViewarg0,查看arg1,

Int arg2,long arg3){

cityId=city_spinner

.getSelectedItemPosition(); //獲取城市的id

strCity=city_spinner

.getSelectedItem()

.toString(); //獲取城市的內容

Log.v('test','city:'

+ city_spinner

.getSelectedItem()

.toString()//輸出測試

+ cityId.toString());

如果(真){

//開始在這里設置縣級內容

County_spinner=(Spinner)findViewById(R.id.county_spinner);

County_spinner

.setPrompt('請選擇縣]);

Switch(provinceId){

案例0:

選擇(county_spinner,

County_adapter,

countyOfBeiJing [cityId]);

打破;

案例1:

選擇(county_spinner,

County_adapter,

countyOfTianJing [cityId]);

打破;

案例2:

選擇(county_spinner,

County_adapter,

countyOfHeBei [cityId]);

打破;

案例3:

選擇(county_spinner,

County_adapter,

countyOfShanXi1 [cityId]);

打破;

案例4:

選擇(county_spinner,

County_adapter,

countyOfNeiMengGu [cityId]);

打破;

案例5:

選擇(county_spinner,

County_adapter,

countyOfLiaoNing [cityId]);

打破;

案例6:

選擇(county_spinner,

County_adapter,

countyOfJiLin [cityId]);

打破;

案例7:

選擇(county_spinner,

County_adapter,

countyOfHeiLongJiang [cityId]);

打破;

案例8:

選擇(county_spinner,

County_adapter,

countyOfShangHai [cityId]);

打破;

案例9:

選擇(county_spinner,

County_adapter,

countyOfJiangSu [cityId]);

打破;

案例10:

選擇(county_spinner,

County_adapter,

countyOfZheJiang [cityId]);

打破;

案例11:

選擇(county_spinner,

County_adapter,

countyOfAnHui [cityId]);

打破;

案例12:

選擇(county_spinner,

County_adapter,

countyOfFuJian [cityId]);

打破;

案例13:

選擇(county_spinner,

County_adapter,

countyOfJiangXi [cityId]);

打破;

案例14:

選擇(county_spinner,

County_adapter,

countyOfShanDong [cityId]);

打破;

案例15:

選擇(county_spinner,

County_adapter,

countyOfHeNan [cityId]);

打破;

案例16:

選擇(county_spinner,

County_adapter,

countyOfHuBei [cityId]);

打破;

案例17:

選擇(county_spinner,

County_adapter,

countyOfHuNan [cityId]);

打破;

案例18:

選擇(county_spinner,

County_adapter,

countyOfGuangDong [cityId]);

打破;

案例19:

選擇(county_spinner,

County_adapter,

countyOfGuangXi [cityId]);

打破;

案例20:

選擇(county_spinner,

County_adapter,

countyOfHaiNan [cityId]);

打破;

案例21:

選擇(county_spinner,

County_adapter,

countyOfChongQing [cityId]);

打破;

案例22:

選擇(county_spinner,

County_adapter,

countyOfSiChuan [cityId]);

打破;

案例23:

選擇(county_spinner,

County_adapter,

countyOfGuiZhou [cityId]);

打破;

案例24:

選擇(county_spinner,

County_adapter,

countyOfYunNan [cityId]);

打破;

案例25:

選擇(county_spinner,

County_adapter,

countyOfXiZang [cityId]);

打破;

案例26:

選擇(county_spinner,

County_adapter,

countyOfShanXi2 [cityId]);

打破;

案例27:

選擇(county_spinner,

County_adapter,

countyOfGanSu [cityId]);

打破;

選擇(county_spinner,

County_adapter,

countyOfQingHai [cityId]);

打破;

案例29:

選擇(county_spinner,

County_adapter,

countyOfNingXia [cityId]);

打破;

案例30:

選擇(county_spinner,

County_adapter,

countyOfXinJiang [cityId]);

打破;

案例31:

選擇(county_spinner,

County_adapter,

countyOfHongKong [cityId]);

打破;

案例32:

選擇(county_spinner,

County_adapter,

countyOfAoMen [cityId]);

打破;

案例33:

選擇(county_spinner,

County_adapter,

countyOfTaiWan [cityId]);

打破;

默認值:

打破;

}

County_spinner

.setOnItemSelectedListener(new OnItemSelectedListener(){

@override

公共無效onItemSelected(

AdapterViewarg0,

查看arg1,

Int arg2,

長arg3){

strCounty=county_spinner

.getSelectedItem()

的ToString();

display.setText(strProvince

+' - '

+ strCity

+' - '

+ strCounty);

}

@override

公共無效onNothingSelected(

AdapterViewarg0){

}

});

}

}

@override

公共無效onNothingSelected(

AdapterViewarg0){

//TODO自動生成的方法存根

}

});

}

}

@override

Public void onNothingSelected(AdapterViewarg0){

}

});

}

/*通過方法*/

動態添加適配器

Private void select(Spinner spin,ArrayAdapter adapter,

Int arry){

//注意這里的arry不僅僅是一個整數,他代表一個數組!

Adapter=ArrayAdapter.createFromResource(this,arry,

android.R.layout.simple_spinner_item);

adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

spin.setAdapter(適配器);

//spin.setSelection(0,true);

標簽:& nbsp& nbsp沈陽app開發&用于城市鏈接選擇的營銷類型網站建設& nbsp沈陽App Design& nbspSpinner

網站建設,小程序開發,小程序制作,微信小程序開發,公眾號開發,微信公眾號開發,網頁設計,網站優化,網站排名,網站設計,微信小程序設計,小程序定制,微信小程序定制

相關案例查看更多

主站蜘蛛池模板: 综合网插插插 | 日韩亚洲av无码三区二区不卡 | 日本少妇高潮叫床声 | 人妻有码av中文字幕久久琪 | 国产不卡视频在线播放 | 日本熟妇无码色视频网站 | 欧洲洲一区二区精华液 | 伊人久久大香线蕉AV色婷婷色 | 蜜臀久久99精品久久久久久小说 | 91丝袜精品久久久久久无码人妻 | 亚洲成人1区2区 | 亚洲色WWW永久网站 日日躁夜夜躁白天躁晚上 欧美最猛黑人xxxx黑人猛叫黄 | 亚洲毛片区 | 久久精品国产亚洲AV未满十八 | 久久色婷婷 | 2022中文字字幕久亚洲 | 国产激情性色视频在线观看 | 欧美激情无码视频一二三 | 伊人久久大香线蕉AV综合 | 北条麻妃国产九九九精品视频 | 久久和欧洲码一码二码三码 | 日本一级特级 | 亚洲欧美v国产一区二区 | 精品无码专区毛片 | 少妇黄色 | 国产精品久久久福利 | 国产两性色午夜视频 | 久热精品视频在线观看 | 午夜无码乱码在线观看 | 99精品国产一区 | 久久中文字幕在线观看 | 四虎剧场| 又色又爽1000部偷拍免费视频 | 青青精品视频 | AV无码岛国免费动作片 | jizz一区 | 午夜黄网 | 亚洲精品乱码久久久久v最新版 | 高潮添下面视频免费看 | 免费午夜成人片 | 亚洲精品屋V一区二区 |