Recent projects to do an e-commerce app, select the delivery address of the three-level linkage scrolling selection component, the control is very simple to use, the following is the effect of its operation:
Layout
<LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Xmlns:su= "Http://schemas.android.com/apk/res-auto"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Tools:context=". Mainactivity "android:orientation= "vertical" > <TextViewAndroid:id= "@+id/tv_name"Android:layout_width= "Match_parent"Android:layout_height= "56DP"android:gravity= "Center"Android:textcolor= "#FF0000"android:textsize= "22SP" /> <TextViewAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "Select Address" /> <com. City.linkage.CityPickerView Android:id= "@+id/citypicker"Android:layout_width= "Fill_parent"Android:layout_height= "156DP"android:layout_gravity= "Center"android:gravity= "Center"></Com.city.linkage.CityPickerView> <ButtonAndroid:id= "@+id/btn"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:text= "OK" /></LinearLayout>
Mainactivity.java
Public classMainactivityextendsappcompatactivity {PrivateCitypickerview Citypicker; PrivateTextView TV; @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (R.layout.activity_main); Citypicker=(Citypickerview) Findviewbyid (R.id.citypicker); TV=(TextView) Findviewbyid (r.id.tv_name); Findviewbyid (R.ID.BTN). Setonclicklistener (NewView.onclicklistener () {@Override Public voidOnClick (View v) {tv.settext (citypicker.getcity_string ()); } }); }}because the code is too many, the complete code is not given, the source directly download can
SOURCE Click to download
Three-level linkage between Android's provincial and urban areas