I want to add the Android EdgeEffect to my custom view when it is touched. I overrode onDraw and then used EdgeEffect.draw(canvas) to draw the effect. However it is always drawn on the top edge of the view when I want it on the right edge. I tried to rotate the canvas with Canvas.rotate(90) but that made the effect disappear altogether.
Any help would be appreciated.
I am writing android app where I have a canvas that can be zoomed in or out and translated in any direction. Now what I need to know is what is the position of user finger ON CANVAS, not on screen. The problem is that I have to write this app with API 9 compatibility.
What I have achieved is that without scaling everything works well.
I am implementing pagecurl effect using canvas in android now i have to implement text to speech functionality on same canvas..So two different functionalities on single ontouch event ..Upto now i implemented pagecurl effect onTouch now i am in confusion to get text on canvas..
i used
canvas.drawText("Hello world this is experiment", 300,400 , paint);
in my app the text will come dynamica
Code:
@Override
public void onDraw(Canvas canvas) {
int myColor = 0;
p.setColor(Color.TRANSPARENT);
canvas.drawRect(0, 0, width, height, p);
if (currentPicture != null) {
p.setColor(Color.RED);
canvas.drawRect(0, 0, width, 200, p);
canvas.drawBitmap(currentPicture, new Rect(0, 0, width, height), new Rect(0, 0, width, height), p);
canvas.translate(tr
I am learning on canvas and bitmap with paths and currently working on a drawing app where user can draw paths freely on the extended view.
The app also allow allowing user to import bitmap as the background and draw on it.
I am trying to use Canvas and Bitmaps to draw in my activity, but I am not getting a hold of things like:
When is the onDraw function called.
How can we call onDraw function again after making changes. (this.invalidate does not seem to do the trick).
How to have something drawn on the canvas and make changes to it and later refresh it.
Can someone explain these?
I've implemented some kind of a vector map using Android's SurfaceView and a Canvas.
Each element of the map is represented by a path that is being drawn in a for loop that draws each path onto the canvas.
Something like this -
void doDraw(Canvas canvas)
{
canvas.drawColor(Color.WHITE);
if (mMapModel == null)
return;
for (MapElement e : mMapModel.ge
I am working on speedometer app using GPS and having problem with the view class of the App.All the properties using in the app aligning to the center except the needle..
The class is extending the view and the code i am using in onDraw method is....
protected void onDraw(Canvas canvas) {
canvas.drawBitmap(speedo_meter, (canvas.getWidth() / 2)- speedo_meter.getWidth() / 2,
(can
ive been trying to change the color of specific rects in an array of rects when i thouch the screen but it doesnt seem to be working, heres my code:
public Paint blue = new Paint();
RandomColorGen rc;
ArrayList<Integer> colors = RandomColorGen.ColorList(5);
Random rand = new Random();
int columns = 50;
int rows = 50;
Rect square[][] = new Rect[rows][columns];
public boolean isTouched;
publ