dialog box for setting font size

Source: Internet
Author: User

1 /**2  * 3 * Event Monitoring4  */5 @Override6      Public voidOnClick (View v) {7         Switch(V.getid ()) {8          CaseR.id.item_back:9 finish ();Ten overridependingtransition (R.anim.lefttoright, r.anim.righttoleft); One              Break; A          Caser.id.item_textsize: - Showcchoosedig (); -  the         default: -              Break; -         } -          +     } -  +     /** A      *  at * Show dialog box -      */ -  -     Private intMcurrentchooseitem;//record the currently selected item -     Private intmcurrentitem=2;//record the font that is changed after the current selection is determined -     PrivateString URL; in      -     Private voidShowcchoosedig () { toAlertdialog.builder Builder =NewAlertdialog.builder ( This);//Create dialog box +          -String[] Items=Newstring[]{"Super Size Font", "Large font", "Normal font", "Small Font", "Super small Font"}; the          *Builder.settitle ("Font settings"); $Builder.setsinglechoiceitems (items, Mcurrentitem,NewDialoginterfacePanax Notoginseng                 . Onclicklistener () { -              the @Override +              Public voidOnClick (Dialoginterface Dialog,intwhich) { ASystem.out.println ("Checked:" +which); themcurrentchooseitem=which; +                  -             } $         }); $          -         /** - * Set the OK button to listen the          */ - WuyiBuilder.setpositivebutton ("OK",NewOnclicklistener () { the              - @Override Wu              Public voidOnClick (Dialoginterface Dialog,intwhich) { -WebSettings settings = Item_webnews.getsettings ();//Create an Websetting object About                  Switch(mcurrentchooseitem) { $                  Case0: - settings.settextsize (Textsize.larger); -                      Break; -                  Case1: A settings.settextsize (textsize.largest); +                      Break; the                  Case2: - settings.settextsize (textsize.normal); $                      Break; the                  Case3: the settings.settextsize (textsize.smaller); the                      Break; the                  Case4: - settings.settextsize (textsize.smallest); in                      Break;  the  the                 default: About                      Break; the                 } theMcurrentitem=mcurrentchooseitem;//after clicking, the font becomes the selected font size the                  +             } -              the             Bayi         }); the          the         /** - * Set Cancel button -          */ theBuilder.setnegativebutton ("Cancel",NULL);//no need to set up monitoring because the default click is canceled the          theBuilder.show ();//Show the dialog box the  -      the}

dialog box for setting font size

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.