How can I draw an rectangle in a android webview? - android

I want to load an external web page (it can be any website) in my android app within an webview. I then want to draw a rectangle around a specific text or an image.
I have the css coordinates where I want to draw the rectangle and of its size. I don't want to change the css layout of the page, only overlay the page with this rectangle.
Then I want to automatically zoom in on the page to the area marked with the rectangle.
Is this possible?
If yes, how?
Thanks in advance!

Related

How to draw a mask (circle) over an Android webview?

I have three weeks into Android development (newbie). Is it possible to draw a mask over a webview so that the webview looks like its a circle? My webview is showing google map (dragable). I want that map in the app to look like its a circle, instead of a rectangle that is filling the entire Layout.
In general, yes. But your webview will be unaware of the mask, so you might run into problems with the mask covering parts of the UI. I don't know about the Google Maps web API, but the Android API lets you set padding to move the controls and Google logo away from the edges.
You can create a custom View in which onDraw(Canvas) instructs some other View to draw into a bitmap, then applies a mask to the bitmap and draws it on the output Canvas. To make your webview appear circular, you'd place the custom view on top of the webview, and configure the custom view to use the view below the webview for drawing. This would create the appearance of a hole through the webview.
Shameless plug: I published a MaskView that does exactly this.

Android How to set the imageview in front of drawingview

I am using drawing view to draw on touch of user , So I need to put the image in front of it. There are some letters written in the middle of image , which is in translucent , while the other places are covered with color. So on touch the user would only see the letter filling with paint as the letter is transparent and translucent.
Edited
is the picture, I want to fill the only white space with color on user touch. Right now I am painting on a white canvas and , truly I have copied the code of touch to draw from android api demo folder. So please Tell me How to fill that white blank space only .
I came up with idea and that is to draw canvas as the source code of api demo is doing , and just put the imageveiw in front of this canvas hence user would only see the white area is filling with color. Any idea that How can I perform this ?
So My major problem is how to put that image view in front canvas in android. ?

Zoom Plaine Object in Android (GLES20)

I have a plaine object which have an image. I want to implementing Zoom in\out this object.
I try use
Matrix.setScaleM(...)
and it works, but it just increases the image in the middle instead of gradually come to the place that I need. At this point I want to make something like a gallery, on each phone it is - open Gallery on your phone and see - when you try to zoom in image - viewport gradually moved to zoomed viewport. So how can i do that?

Create draggable edge point on imageView

I want to create a resize feature of my application but I cannot find a sample implementation of it. Many tutorials offers pinch to zoom.
My problem now is how to implement draggable edges to resize the image just like in ordinary image editor. Do you have any idea how to do this? Just like putting circles/points on the 4 corners of the ImageView like the sample image below.
Is it possible to use the crop library of android to have draggable image?
You can draw the control point, and handle all festure in this point
last month i develop a Android handwritting note app. In this app, i inherit View, and control View.onDraw directly. I draw the image and all control indicator in onDraw, and handle screen touch within the scope of the screen.
This app isn't accomplished, it become a opensource project, you can see the source at https://bitbucket.org/gd920129/white-board/

android crop/save image after zoom and drag

in my application I want to have a frame (with a hole in the middle) and an image under it. I want to be able to drag and zoom the image to fit (the face in the picture) it in the frame. Then Crop the image (could I find the pixel x,y that are in the border of the screen?) and then save the zoomed image so that I can put the frame over it then.
Any suggestions? If possible please tell me the classes I will have to use.
Thanks!!
It is possible to do all the functionalities (What you have discussed above) using Android View class with onDraw method and canvas Object.
Refer the link:
http://developer.android.com/reference/android/graphics/Canvas.html

Categories

Resources