Three-level linkage between Android's provincial and urban areas

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.