Android Bottom pop-up IOS7 Style dialog Options box

Source: Internet
Author: User

"Android Bottom popup iOS7 Style dialog box"

As follows:


Online streaming Android Bottom pop-up iOS7 Style dialog box open source code, original author unknown. I spread the code based on the Internet to improve a number of places, the original as application released code into an Android library, if in the future Android projects need such a dialog box style, You only need to download my last full library project to CSDN (full Android Library project code I've uploaded to csdn,:http://download.csdn.net/download/zhangphil/8573925), Import into Eclipse and then introduce it as a library into your own project and use it directly as a third-party control.

As a code demonstration, create a new Android project that uses the library project that I provided.

For example, it is used directly in mainactivity:

Package Zhangphil.iosdialog.demo;import Zhangphil.iosdialog.widget.actionsheetdialog;import Zhangphil.iosdialog.widget.actionsheetdialog.onsheetitemclicklistener;import Zhangphil.iosdialog.widget.actionsheetdialog.sheetitemcolor;import Zhangphil.iosdialog.widget.AlertDialog; Import Android.app.activity;import Android.os.bundle;import Android.view.view;import Android.view.view.onclicklistener;import Android.widget.button;import Android.widget.toast;public Class Mainactivity extends Activity implements Onclicklistener {Private button btn1;private button btn2;private button btn3;pri Vate button Btn4;private button btn5; @Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate ( Savedinstancestate); Setcontentview (R.layout.activity_main); Initview ();} private void Initview () {btn1 = (button) Findviewbyid (R.ID.BTN1); Btn1.setonclicklistener (this); btn2 = (Button) Findviewbyid (R.ID.BTN2); Btn2.setonclicklistener (this); btn3 = (Button) Findviewbyid (R.ID.BTN3); Btn3.setonclicklistener (thIS), Btn4 = (button) Findviewbyid (R.ID.BTN4); Btn4.setonclicklistener (this); btn5 = (Button) Findviewbyid (R.ID.BTN5); Btn5.setonclicklistener (this);} @Overridepublic void OnClick (View v) {switch (V.getid ()) {case R.id.btn1:new Actionsheetdialog (mainactivity.this). Builder (). Settitle ("After emptying the message list, the chat history remains, OK to clear the message list?"). "). Setcancelable (True). Setcanceledontouchoutside (True). Addsheetitem (" Empty message list ", Sheetitemcolor.red,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) {}}). Show (); Break;case r.id.btn2:new Actionsheetdialog (mainactivity.this). Builder (). Setcancelable (True). Setcanceledontouchoutside (True). Addsheetitem ("Send To Friend", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) {}} ). Addsheetitem ("Reprint to Space album", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which {}}). Addsheetitem ("Upload to Group album", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) {}}). Addsheetitem ("Save to Phone", sheetitEmcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) {}}). Addsheetitem ("Favorites", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) {}}). Addsheetitem (" View chat picture ", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) {}}). Show (); Break;case r.id.btn3:new Actionsheetdialog (mainactivity.this). Builder (). Settitle ("select operation"). Setcancelable (True). Setcanceledontouchoutside (True). Addsheetitem ("entry One", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@ overridepublic void OnClick (int which) {Toast.maketext (Mainactivity.this, "item" + which, Toast.length_short). Show ();}). Addsheetitem ("Entry II", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) { Toast.maketext (Mainactivity.this, "item" + which, Toast.length_short). Show ();}}). Addsheetitem ("entry three", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) { Toast.maketext (MainactivitY.this, "item" + which, Toast.length_short). Show ();}}). Addsheetitem ("entry Four", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) { Toast.maketext (Mainactivity.this, "item" + which, Toast.length_short). Show ();}}). Addsheetitem ("Entry Five", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) { Toast.maketext (Mainactivity.this, "item" + which, Toast.length_short). Show ();}}). Addsheetitem ("entry Six", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) { Toast.maketext (Mainactivity.this, "item" + which, Toast.length_short). Show ();}}). Addsheetitem ("Entry seven", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) { Toast.maketext (Mainactivity.this, "item" + which, Toast.length_short). Show ();}}). Addsheetitem ("Entry VIII", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) { Toast.maketext (Mainactivity.this, "item" + Which, toast.length_short). Show ();}}). Addsheetitem ("Entry IX", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) { Toast.maketext (Mainactivity.this, "item" + which, Toast.length_short). Show ();}}). Addsheetitem ("Entry ten", Sheetitemcolor.blue,new Onsheetitemclicklistener () {@Overridepublic void OnClick (int which) { Toast.maketext (Mainactivity.this, "item" + which, Toast.length_short). Show ();}}). Show (); Break;case r.id.btn4:new Alertdialog (mainactivity.this). Builder (). Settitle ("Exit Current Account"). Setmsg ("15 consecutive days, On the variable as QQ talent. Quitting QQ may make your existing record zero, OK exit? "). Setpositivebutton (" Confirm Exit ", new Onclicklistener () {@Overridepublic void OnClick (View v) {}}). Setnegativebutton (" Cancel ", New Onclicklistener () {@Overridepublic void OnClick (View v) {}}). Show (); Break;case r.id.btn5:new Alertdialog ( mainactivity.this). Builder (). Setmsg ("You can't receive a new message alert now. Please turn on the message alert in the system-settings-Notification "). Setnegativebutton (" OK ", new Onclicklistener () {@Overridepublic void OnClick (View v) {}}). Show (); Break;default:break;}}}

Activity_main.xml files required by mainactivity:

<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools "android:layout_width=" match_parent "android:layout_height=" Match_parent "Android:orien tation= "vertical" > <button android:id= "@+id/btn1" android:layout_width= "Match_parent" Andro id:layout_height= "wrap_content" android:text= "message"/> <button android:id= "@+id/btn2" Android:        Layout_width= "Match_parent" android:layout_height= "wrap_content" android:text= "Picture"/> <Button Android:id= "@+id/btn3" android:layout_width= "match_parent" android:layout_height= "Wrap_content" and roid:text= "List"/> <button android:id= "@+id/btn4" android:layout_width= "Match_parent" Android : layout_height= "wrap_content" android:text= "button One"/> <button android:id= "@+id/btn5" android:l Ayout_width= "Match_parent" android:layout_height= "wrap_content" android:text= "button two"/></linearlayout> 



Android Bottom pop-up IOS7 Style dialog Options box

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.