Use of Android Zoomcontrols

Source: Internet
Author: User

We usually on the phone, especially after the use of access to the browser, often see some of the game will zoom out, in fact, very simple.

------------------------the use of zoomcontrols.

public class Zoomcontrolleractivity extends Activity{private TextView mytextview;private zoomcontrols Myzoomcontroller ;p rivate int size = 25;; @Overrideprotected void OnCreate (Bundle savedinstancestate) {//TODO auto-generated method Stubsuper.oncreate ( Savedinstancestate); Setcontentview (r.layout.zooncontroller_layout); Mytextview = (TextView) Findviewbyid ( R.id.mytextview); Myzoomcontroller = (zoomcontrols) Findviewbyid (R.id.myzoomcontroller);; Myzoomcontroller.setonzoominclicklistener (New Onzoomintroller ()); Myzoomcontroller.setonzoomoutclicklistener (new Onzoomouttroller ());} /** * Shrink Listener * @author Androidstartjack * */private class Onzoomintroller implements onclicklistener{@Overridepublic void O Nclick (View v) {toast.maketext (Getapplicationcontext (), "Aaaaaaa", 0). Show (); size = Size +2;mytextview.settextsize ( size);}} /** * Magnification listener * @author Androidstartjack * */private class Onzoomouttroller implements onclicklistener{@Overridepublic void OnClick (View v) {size = Size-2; Toast.maketext (getapplicAtioncontext (), "bbbbbbbbbbbbbbbb", 0). Show (); mytextview.settextsize (size);}}} 

------XML Code:

<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android "    android:layout_width=" match_parent "    android:layout_height=" match_parent "    android:o rientation= "vertical" >    <textview        android:id= "@+id/mytextview" android:layout_width= "Match_        Parent "        android:layout_height=" 50DP "        android:background=" #fe00fe "        android:gravity=" center "        Android:text= "This is the study of Zoomtroller"/>    <zoomcontrols        android:id= "@+id/myzoomcontroller"        android:layout_width= "wrap_content"        android:layout_height= "wrap_content"        android:gravity= " Center_horizontal "/></linearlayout>

See if it's simple. Of course you can make a variety of sizes according to your needs.

Use of Android Zoomcontrols

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.