I am trying to implement an app where a simple image (floor plan of a room ) is used as a map.
Actually I am not clearly sure about how to do it. But after some searching, I follow one of instructions in a blog.
I am using a WebView to show the image. I am using three different size of the image for three specific zoom level.
There are two button zoomIn and zoomOut. I am just loading a different image when zoom level is changed.
Is it right way?
To enable zoom on the WebView, add the following code:
webView.getSettings().setBuiltInZoomControls(true);
for your button 1:
int zoom_level=100;
webview1.setInitialScale(zoom_level);
webview1.loadData("url");
repeat same for other buttons.
Related
I have a list of image URLs and have to show them and change them automatically in ImageView and need to count how many times every image appears to the user.
What could be the best approach to do this? can we avoid handlers here?
Android provides views which can be used to display images from various sources and provide transitions between them. Some of these views are the ImageView and the ImageSwitcher. These views provide a high level of functionality to display images in a user interface so that we can concentrate on the images we want to display rather than taking care of rendering.
You can get complete guide setup in links description.
In description there is a complete explaination for changing image using ImageSwitcher
by pressing a button, But by updating the code to change after certain can be done easily.
Link to tutorial:
https://www.sitepoint.com/handling-displaying-images-android/
A github link for application used with image switching button:## Heading ##
https://github.com/Adarshgkp04/Android_Image_transitions.git
Feel free to ask queries.
In my project, there is a activity where I need to load 2/3 images from server in a image view. Then need to do the below operation with them:
Paging, zooming and rotation by touch gesture.
I have searched a lot but could not manage to find any suitable library for those options.
I tried to achieve it by combining libraries( Picasso +others) but could not manage.
Please guide my to achieve this.
Any sample code, library reference or tutorial will be better.
TouchImageView
which helps to zoom the image
I really like Volley for working with image downloads. It offers a class called "NetworkImageView" which allows you to give it a URL and it loads the image directly, and even scales it down if needed.
As for your zoom & rotation gestures, have a look at uk.co.senab.PhotoView - it's a class which extends ImageView (you can change it to extend NetworkImageView), and allows touch interactions such as zoom. I'm not sure if it supports rotation, but I'm sure that once you get familiar with it, you can add this functionality.
Volley: https://github.com/mcxiaoke/android-volley
PhotoView: https://github.com/chrisbanes/PhotoView
I am trying to create an application which has a map image in it.
I want to add some areas (or buttons) to it so that when you click them the bubbles with information will appear.
I am new in android programming so asking to explain a bit how to implement it?
Also i need an image to be re-sizable just like a real map.
So should i attach the buttons to specific places on image and how to do so that the buttons will be connected to it when i re-size an image?
Which image type is better to use for this purpose? I heard that SVG would be better but i couldn't even add svg image to an application.
I appreciate any helpful advice.
For your problem you can use this:
http://catchthecows.com/?p=113
I need something similar, but the click on the image should change the content of that part as well.
When I find or implement the final solution I can post it here.
I created an app that has a small image loaded from URL of a website. I want that when user clicks on that small image it'll show the image in full screen and will also have the ability to zoom and pan that image.
What I've done was showing the image in WebView with built-in zoom controls but the result was ugly. (I've set the layout to wrap_content so no white areas are shown, but it cause the image doesn't zoom dynamically).
Any solution? and sorry for my bad English.
Problem solved! For anyone who have the same problem, I've use this library and it works great! http://blog.sephiroth.it/2011/04/04/imageview-zoom-and-scroll/
Here's a link to the Github ImageViewZoom page.
You can build that from scratch or... you can use this library:
http://code.google.com/p/android-pinch
Take a look at the PinchImageView class
You need to use GestureDetectors. Google has excellent sample interactiveChart for this, see https://android.googlesource.com/platform/development/+/master/samples/training/InteractiveChart
and http://developer.android.com/training/gestures/scroll.html
I have two questions:
I find this code to use pinch in the webImageView but when I change webImageView by WebView. I obtain an error in the code. how I use pinch in the webview??
// create the WebImageView object from xml
WebImageView img = (WebImageView) findViewById(R.id.main_pic);
// fetches the image in a background thread
img.setImageFromURL("http://www.mysite.com/mypicture.jpg");
// enable pinch-zoom abilities on the image
new PinchImageView(img);
When I add pinch in my code is that supported by all the mobile android or you should have a specific screen to make it work it.
You can enable zooming in a WebView by following WebView setting
mWebView.getSettings().setBuiltInZoomControls(true);
Also you can set the default zoom level by using ZoomDensity
mWebView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.CLOSE);
Have you added the referencing library of Nikko?
http://code.google.com/p/android-pinch/wiki/PinchImageView