Thursday, March 21, 2013

e. How to give a zoomable picture in an Application

Zoomable pictures are only supported in Webview and Mapview. So first we have to create a Webview layout with zoom controls in it.
First copy the picture in to the assets folder
Then, Copy the following code in to activity_main.xml file

<RelativeLayout 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"
    tools:context=".MapActivity" >
       
       
        <ZoomControls
            android:id="@+id/zoomControls1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_marginBottom="52dp"
            android:layout_marginRight="20dp" />

        <WebView
            android:id="@+id/webView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"           
            android:layout_alignParentTop="true"
             />

</RelativeLayout>


Now vopy the following code in the oncreate method,in ActivityMain.Java file

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);
        // Show the Up button in the action bar.
        //getActionBar().setDisplayHomeAsUpEnabled(true);
       
        WebView WV = (WebView)findViewById (R.id.webView1);
        WV.loadUrl("file:///android_asset/kerala.jpg");
        WV.getSettings().setBuiltInZoomControls(true);
        WV.getSettings().setSupportZoom(true);
         
    }


You are done.Dont forget to replace the kerala.jpg file name with your filename of picture. Just run the application yoiu will find the picture as zoomable.

15 comments:

  1. Zoomable picture is good fun and android application developers can develop this according to the requirement. This xml file help for the same one. Great one.

    ReplyDelete
  2. This page is insightful and helpful. Lots of people will assert that everything in your site is great. asp.net training in jalandhar

    ReplyDelete
  3. Thanks for sharing this information. your blog is good and I got so much knowledge. Please visit https://goo.gl/Za2Qf4

    ReplyDelete
  4. hello,
    i just want to say that you have clearly mention the process very clearly and i also found it is very much easy
    to understand. keep sharing.

    ios app development company in chennai

    ReplyDelete
  5. Great post. I was checking continuously this blog and I am impressed! I enjoyed reading your post. Please continue publishing helpful information like this. I like this type of information and share my opinion with you.Digital Marketing Company in India | Travel Technology Software | Software Development Solutions in India | Web Design Services in India | Mobile App Developer Noida

    ReplyDelete
  6. The using this method cheap essay does not require any special skills for a successful completion. The scalable image easily becomes noticeable thanks to this.

    ReplyDelete
  7. Hello sir,
    Thank you very much for sharing this huge explosion with us. It's really helpful and informative.
    Keep blogging for new updates.

    DedicatedHosting4u.com

    ReplyDelete
  8. This is most informative and also this post most user-friendly and super navigation to all posts.
    Online Data Science Classes
    Selenium Training in Pune
    AWS Online Classes
    Python Online Classes

    ReplyDelete
  9. Hey Nice Blog!! Thanks for Sharing!!!Wonderful blog & good post. It’s really helpful for me, waiting for a newer post. Keep Blogging!
    Best Online Bookstore in Patna

    ReplyDelete
  10. You have shared some amazing ideas!
    Good work and thank you for sharing this information.
    I congratulate your effort to do this.
    Online Book Shopping Application
    Online Book Shopping App

    ReplyDelete

Please give your valuable comments so as to know whether this blog is useful to you.You can also write helpful Android Development Syntax or Shortcuts or Tips.