I want to draw A Rectangle over a Image In Horizontal And Vertical Direction Just Like a Grid.
I can use grid but when I Pan(Drag) image this won't work. The rectangle should also Pan with the Image or shold move with the Image.
The easiest way should be to have a view that draws the shape you want and your image together in a frame layout.
And then you should move the layout of both view rather than the view alone.
Related
I have total 5 image views in linear layout.first round it shows only 3 image views centre of the layout and second round first 3 image views are scale down or translate and visible the 4th image view and centre of the partent. and third round 4 views are scale down and visible the 5th image view in centre of the parent.
How to achive this in android using animations?
Animations can be performed through either XML or android code. Here you get animation using xml.
http://www.androidhive.info/2013/06/android-working-with-xml-animations/
Hope it helps !
How to zoom in - out relative layout containing child views with the background image?
I am able to zoom in out relative layout but the background image bitmap on the relative layout is constant and not able to scale.
Maybe this can help you? It's library for zooming in/out an image view.
https://github.com/chrisbanes/PhotoView
I have a custom ViewGroup that contains an ImageView and a few other TextViews that display white text on the image. I would like to draw ONE dark rectangle under all the textviews to improve the contrast.
To accomplish this, in the custom ViewGroup's onLayout, I compute the smallest rectangle that contain all of the TextViews. Now, I have no idea how to draw the rectangle on top of the first child (the image), but below the other children, the TextViews. So I would like to draw the children in the order:
ImageView (first child)
Computed dark Rect
TextViews (all other children)
I tried overriding dispatchDraw() and then after the call to super.dispatchDraw(canvas), I drew the rectangle. But that obviously put the rectangle over the TextViews.
I would appreciate any help.
Thanks!
I've got a framelayout with a 2 pixel border. In the corner of the framelayout, there's a button that the user can drag to resize the layout. I'm doing the resizing by listening to onTouch and calling setScale on the framelayout.
The problem I'm having is that the border and button get skewed when I call setScale on the layout. Is there a way to achieve this resizing effect while keeping the border at 2 pixels and the button inside the layout the same size?
Can you draw a rectangle in a scrollview? If so how? I did some searching and I was not able to find an answer. Specifically, I want the rectangle IN the scrollview so that when I scroll the rectangle moves with the view, as opposed to a rectangle being on top of the scrollview, where the scrollview would scroll under the rectangle and the rectangle would remain on top where it is.
You need to create a class that extends ScrollView and override onDraw(). There you can draw whatever you want. To make the drawing scroll with the content, you should offset the locations with the values you get by getScrollX() or getScrollY().