) The iOS7 Style dialog box (QQ dialog box) -- Third-Party open source -- IOS_Dialog_Library and android iOS 7

Source: Internet
Author: User

(Switch) The iOS7 Style dialog box (QQ dialog box) -- Third-Party open source -- IOS_Dialog_Library and android iOS 7

This article is reproduced in: http://blog.csdn.net/zhangphil/article/details/44940339

IOS_Dialog_Library

: Http://files.cnblogs.com/files/zzw1994/IOS_Dialog_Library.zip

Or: http://download.csdn.net/download/zhangphil/8573925

After downloading it, import it to Eclipse, and introduce it to your project as a Library, which is directly used as a third-party control.

Test code:

1 <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" 2 xmlns: tools = "http://schemas.android.com/tools" 3 android: layout_width = "match_parent" 4 android: layout_height = "match_parent" 5 android: orientation = "vertical"> 6 7 <Button 8 android: id = "@ + id/btn1" 9 android: layout_width = "match_parent" 10 android: layout_height = "wrap_content" 11 android: text = "message"/> 12 13 <Button14 android: id = "@ + id/btn2" 15 android: layout_width = "match_parent" 16 android: layout_height = "wrap_content" 17 android: text = "image"/> 18 19 <Button20 android: id = "@ + id/btn3" 21 android: layout_width = "match_parent" 22 android: layout_height = "wrap_content" 23 android: text = "list"/> 24 25 <Button26 android: id = "@ + id/btn4" 27 android: layout_width = "match_parent" 28 android: layout_height = "wrap_content" 29 android: text = "quit"/> 30 31 <Button32 android: id = "@ + id/btn5" 33 android: layout_width = "match_parent" 34 android: layout_height = "wrap_content" 35 android: text = "error message"/> 36 37 </LinearLayout>Activity_main.xml

MainActivity. java:

1 package com. example. testiosdialog; 2 3 import zhangphil. iosdialog. widget. actionSheetDialog; 4 import zhangphil. iosdialog. widget. actionSheetDialog. onSheetItemClickListener; 5 import zhangphil. iosdialog. widget. actionSheetDialog. sheetItemColor; 6 import zhangphil. iosdialog. widget. alertDialog; 7 import android. app. activity; 8 import android. OS. bundle; 9 import android. view. view; 10 import android. vie W. view. onClickListener; 11 import android. widget. button; 12 13 public class MainActivity extends Activity implements OnClickListener {14 15 private Button btn1, btn2, btn3, btn4, btn5; 16 17 @ Override 18 protected void onCreate (Bundle savedInstanceState) {19 super. onCreate (savedInstanceState); 20 setContentView (R. layout. activity_main); 21 initView (); 22} 23 24 private void initView () {25 btn1 = (Button) findViewById (R. id. btn1); 26 btn2 = (Button) findViewById (R. id. btn2); 27 btn3 = (Button) findViewById (R. id. btn3); 28 btn4 = (Button) findViewById (R. id. btn4); 29 btn5 = (Button) findViewById (R. id. btn5); 30 31 btn1.setOnClickListener (this); 32 btn2.setOnClickListener (this); 33 listener (this); 34 listener (this); 35 btn5.setOnClickListener (this); 36} 37 38 @ Ove Rride 39 public void onClick (View v) {40 // setCancelable setting canceled, setCanceledOnTouchOutside setting cancel 41 switch (v. getId () {42 case R. id. btn1: 43 new ActionSheetDialog (MainActivity. this) 44. builder () 45. setTitle ("after clearing the message list, the chat record is retained. Are you sure you want to clear the message list? ") 46. setCancelable (true) 47. setCanceledOnTouchOutside (true) 48. addSheetItem ("clear message list", SheetItemColor. red 49, new OnSheetItemClickListener () {50 51 @ Override 52 public void onClick (int which) {53 54} 55 }). show (); 56 break; 57 58 case R. id. btn2: 59 new ActionSheetDialog (MainActivity. this) 60. builder () 61. setCancelable (true) 62. setCanceledOnTouchOutside (true) 63. addSheetItem ("send to friend", 64 S HeetItemColor. blue, 65 new OnSheetItemClickListener () {66 67 @ Override 68 public void onClick (int which) {69 70} 71}) 72. addSheetItem ("reprinted to space album", 73 SheetItemColor. blue, 74 new OnSheetItemClickListener () {75 76 @ Override 77 public void onClick (int which) {78 79} 80}) 81. addSheetItem ("upload to group album", 82 SheetItemColor. blue, 83 new OnSheetItemClickListener () {84 85 @ Override 86 public void onClic K (int which) {87 88} 89}) 90. addSheetItem ("Save to cell phone", 91 SheetItemColor. blue, 92 new OnSheetItemClickListener () {93 94 @ Override 95 public void onClick (int which) {96 97} 98 }). show (); 99 break; 100 case R. id. btn3: 101 new ActionSheetDialog (MainActivity. this) 102. builder () 103. setTitle ("friend List") 104. setCancelable (true) 105. setCanceledOnTouchOutside (true) 106. addSheetItem ("delete friends", SheetItemColor. red 107, new OnSheetItemClickListener () {108 109 @ Override110 public void onClick (int which) {111 112} 113}) 114. addSheetItem ("Add friends", SheetItemColor. blue115, new OnSheetItemClickListener () {116 117 @ Override118 public void onClick (int which) {119 120} 121}) 122. addSheetItem ("Remarks", SheetItemColor. blue123, new OnSheetItemClickListener () {124 125 @ Override126 public void onClick (int which) {127 128} 129 }). show (); 130 break; 131 // setNegativeButton must be lighter than setPositiveButton by 132 case R. id. btn4: 133 new AlertDialog (MainActivity. this) 134. builder () 135. setTitle ("Exit current account") 136. setMsg ("another 15 consecutive days of login, you can become a QQ talents. Exiting QQ may bring your existing records to zero. Are you sure you want to quit?) 137. setPositiveButton ("confirm to exit", new OnClickListener () {138 139 @ Override140 public void onClick (View v) {141 142} 143}) 144. setNegativeButton ("cancel", new OnClickListener () {145 146 @ Override147 public void onClick (View v) {148 149} 150 }). show (); 151 break; 152 case R. id. btn5: 153 new AlertDialog (MainActivity. this) 154. builder () 155. setTitle ("error message") 156. setMsg ("your mobile phone SD card has a problem. We recommend that you delete unnecessary files; otherwise, you cannot receive images, videos, and other files.") 157. setPositiveButton ("OK", new OnClickListener () {158 159 @ Override160 public void onClick (View v) {161 162} 163 }). show (); 164 break; 165} 166} 167}

 

Related Article

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.