Resize an image whithout scaling it - android

I'm trying to resize a viewGroup from the right to the left. Inside my viewgroup I have some images. I tried to put all the scaletype values. The problem is that my images are getting scaled. I want them not too move.
What I want is basically resize my view and not see the image being scaled. Like if the view was hide by something going in front of it. I'm doing an animation so the goal is suposed to simulate a hidding motion. Like a truck passing in front of a car, the car is not scaled, just hide. The car is my view and the truck the width. I don't want to hide it with another view in front of it by making a translation. If possible i don't want to touch to my images, I already put the centerCrop value, but if you have a solution with it, share it please lol.
I don't have the code under my hands right now so I can't show you, but if you have any idea, thanks to share ;).

Related

Scroll Image View to Top Programmatically

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.

Android: make the size of a custom view bigger than the size of screen

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.

making UI layout with custom shape buttons

I want to make a layout like this. This app will be for my own use only i don't have much experience in graphics with android. I have draw these images and saved as PNG separately. I tried to put them in a layout, but i face to many difficulties with spacing and correct placing. But PNG is a rectangle and it clicks outside the image. So i think about preparing all possible situation and load all image as background. Touchable area rectangle(invisible) would be drawn inside button.
Is it a good practice to load image as a background when touch? I would have 16x4=64 backgrounds
What difficulties i can face in the future?
Should i stick to the black background and load separate buttons?
If above "Yes", then to draw background and image is better to resize image in pixels in a drawing SW like Corel? In my case 1280x720
1:
And the touch area would be something like this so i don't think it is possible to misclick it?
2:
With classic View, you won't be able to do non-rectangular view (you can draw want ever you want but your touch area is still rectangular).
The easiest way is to handle the onTouchEvent on a large View (fillin the screen with your image as background) with a View.OnTouchListener and calculate above which (fake) button you are.
For highlights you can use SurfaceView (could be the tricks #Frank.N.Stein talks about).
The hardest way is to use OpenGL graphics ... good luck for a someone who doesn't "have much experience [...]".

How to build a large image viewer

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.

Create a view carousel

I'd like to create something like a carousel with views. A continuum queue with an indetermined amount of the same type of view (just like a list), but when swiping left/right, (or up/down) it would move to the next/previous view (I could be cool if it did that with an animation, too). Plus, I also need to move though it by buttons. For example, "move to view 20".
Could you give me an advice on what to use for my purpose? Thanks in advance
Edit: By the way, grey big thing in the picture represents the current view, while the other thinner rectangles are the preceding and following view.
Please take a look on this answer Android page control like book?
You can make gaps between pages with setting margins or padding.

Categories

Resources