Does it call scale? I need to use the zoomable function as what we do in browser with two finger. It seem zoom controls restricts alot on ImageView though. My images are in drawable, so i assume calling them through (R.drawable.myimage);
and btw im displaying my image with .setContentView(R.layout.myxml);
Related
I am making a simple game on android. I want to make a map that would be able to zoom, so the images on it have to disappear when they left the screen. I want to put an image for background and put other images on it. The problem is that the images don't "stick" to the map, so when i zoom the background the images are still in the same place of the screen. I was looking for the solution in the internet, but i didn't find anything. I am writing in Android Studio in java.
I'm trying to take a screenshot with Robot and view it in an ImageView, The problem is the screenshot coordinates is the ImageView Global coordinates.
So basically I'm trying to capture what's behind the Imageview but instead I get a picture of the Imageview itself.
I can't minimize because I'm taking several continuous screenshots that may vary in resolution.
What can I do?
I was wondering how to achieve this. Is it like you instantiate a textView and let the user position it and set properties and then when the user hit the save button you take the property from the textView and make a paint object an add it to bitmap image? (if yes how do you get and set the position because the image that user sees is normally scaled down so it fit on the screen)
or is it like you make a new bitmap combining TextPaint and DynamicLayout like this (i dont know how to get width and height of my text because it will change based on text size, font, text length, etc...)
I'm a beginner and this would be my first app and also new to Java.
You would want to use canvas or Surface view. You would use bitmap to draw the image and then you canvas.paintText(...) to 'draw' the text with a Paint() data type. Use MotionEvent to follow the User's input. I'm not certain on how to save the canvas but I've heard of it being done fairly easily. You can use this site for learning the basics of canvas, paint, bitmap, Motion Events, and more. http://gamecodeschool.com/android/coding-a-breakout-game-for-android/
I can't provide specific examples with out code.
Hope this Helps!
Developing an app for Android and I'm required to have a fullscreen image rotate (spin around infinitely, pivoted at the centre of the screen) in the background.
I have tried rotating the ImageView using RotateAnimation which works well, except the image is cropped to the size of the parent view.
I have also tried expanding the parent view to a set size (750dp) but it doesn't work well across all the different screen sizes.
Does anyone know of an easy way to implement this, which would involve scaling to uniformly fit the screen size?
Cheers,
Dylan
Screenshot of the image:
I want to have an image on the android screen where different parts of the image can be clickable. What I mean is that, If its an image of 3 circles, I want to be able to click each of these circles,
Then I can add different functionalities to each of these clickable circles.
For an instance in this image below I want to be able to click each distinct color. Is it possible to have on-touch-listener and get you the color ? and can it be an image or has to be drawn in Java OR XML ?
I found a really good widget that helps you make any image muli-clickable. They have some good notes on how to use their widget as well.
The widget has a similar approach as Image mapping in html. The good thing about this widget is that the image can be zoomed and it will not lose the coordinates or areas associated to specific clicks.
Here is the link to their website. the guy who made the widget apparently had similar problem and came up with this widget.
Another solution would have been
creating an ImageView containing the png file referenced
making the whole ImageView clickable
setting an OnTouchListener to the ImageView which overrides the onTouch method
check the colors of the image pixel at the touch position
This is often done with an invisible mask image with one color for each zone (see the popular detailed tutorial), but here the image itself has distinct colors for each zone which makes it more interesting.