Is this possible, have anyone done anything close to this? I saw this behaviour in an ios app and need to reproduce it, basically the image is full size on the X axis and it can move up and down through the Y axis inside an Imageview, I tried doing this with an Imageview inside a FrameLayout without success, the Image is always cropped to the max size of the Imageview which is relative to its parent (FrameLayout). Any help is welcome.
I guess you could just write your own class. Intercept the touch events, monitor the vertical offset and redraw the image with this vertical offset.
Related
I am using TouchImageView in my app to display images.
https://github.com/MikeOrtiz/TouchImageView
As far as I know, Android does not have an easy way to show an image Top Cropped. The best I can do is to Center Crop the Image, which causes the top and bottom of the image to extend off of the screen.
Is there a way to programmatically scroll my image after it has been loaded, and then call ImageView.setVisibility(true)?
I've tried image.scrollBy(int x, int y);
but I'm not sure exactly how to use it.
I do have the ability to get pixel values for both my screen, and for my image before it is scaled, but don't know what function I should use those values in.
Thanks for your input.
enter image description hereI have a custom view and the user can draw rectangles(I used canvas). I would make the size of custom view bigger than the size of the screen. So, the user can draw not only in the size of screen. I tried ScrollView and NestedScrollView but they are not helpful to solve my problem.
As far as I could understand from this question is you want to make a canvas where someone can draw some pictures. So you need a bigger canvas to that user can drag the positions to left-right, up and down. If I understood correctly, then I would say, you might think of a different work-around instead of looking for a view bigger than the screen size.
You can think of an simple ImageView which will be auto zoomed-in and if the user clicks twice it'll zoom-out. The user can drag the positions of the ImageView whenever he wants.
Here's an SO answer about how you can implement the zoom in and out in an ImageView. Hope this will help to solve your problem.
In my Android app, I am using a RelativeLayout to custom one of my Activitys.
I have a square ImageView that I want to set precisely. In other words, I want its right border to touch the horizontal center of the layout.
Is such a thing possible without doing weird things such as centering and then marging?
It's not a perfect solution but potentially you could use:
android:layout_marginRight="xdp"
Where x is half of your screen width + half the width of your imageView?
I know it's not perfect but might help until some guru comes along
I'm implementing an animation which displays scrolling image. I need to display a image in its original size even if the width is more than the screen width and then have to animate it.
Please tell me how to place image like that.
Check out the different scaletypes here: http://bon-app-etit.blogspot.be/2014/01/imageview-scaletypes.html
I think you'll need android:scaleType="centerCrop"
There are couple of things you can do and it depends on the behavior you want to implement. A quick two solutions are:
You can use ScrollView with your image in it and by touching it you can move it left or right. Example solution you can find here: Displaying an image larger than the device's screen
You can use absolute layout (although this layout is already deprecated) and place your image in it. Make the layout width and height be the same as your image.
The animation can be done with many ways:
1. On touche event handling
2. Fling with scroller or gesture detector
3. Accelerometer tilt
Hope it directs you to the right solution.
Try using scaleType in ur imageview xml,
android:scaleType="fitXY"
I need to build a component to view large images.
I cannot put the ImageView in a ScrollView because I will need to be handle other touch events on the image.
The ideal would be to build a "viewer"
with an horizontal handle
and a vertical handle
that enable to move where the picture is centered so that I can scroll the image using the handles without touching the picture itself.
I would like to achieve something like in the following picture, I have researched but I was not able to find any Android API or other component/library that I could use.
Thank you very much for any suggestion.
Best thing I can think of is use two custom scrollbars for the horizontal and vertical scroll. In an onChange() function you can change the crop area on the master image and display the cropped image. Depedning on how it is done you can get a slide effect going for the image.