I would like to develop a function so that i can edit and draw some lines on the existing image. Can anyone give me some idea how to implement it? thanks!
You should ask in detail; explaining what have you done till now, how are you approaching it.
Anyways, Refer this series of blog- Drawing with Canvas, it will get you going.
First you have to load the image like this. Then you can draw on it like this.
Related
this is my first question here, so maybe I'll make some mistakes.
I want to create an Android app for touch test, and draw a cross on the screen, however I'm succeeded to draw cross, but now I want to implement test screen login.
What I want to do is that, When user clicks on any circle it should be removed/hidden or change color to transparent.
Any kind of help would be appreciated.
this is the link to my code.
https://github.com/akhlaqshah36/stackoverflow_questions/blob/master/drawCicles
and attached screenshot.
I got the solution by using some formulas of distance and Using Pointer objects.
check the solution here if someone need it.
Solution Link drawing cross in canvas
I've been searching for simple example and solution in stackoverflow, but I couldn't find one. So, I'll ask a new one and my apologies if this question have been asked before.
First, I want to make an apps that draw a Japanese Kanji Stroke using bezier curve, I already have 1 starting point, with 3 curves, for example :
M(11,54.25)
c(3.19,0.62) (6.25,0.75) (9.73,0.5)
c(20.64,-1.5) (50.39,-5.12) (68.58,-5.24)
c(3.6,-0.02) (5.77,0.24) (7.57,0.49)
What I have been found during searching in internet is, it looks like I could use Path.cubicTo() and use canvas as to draw it (using canvas.drawPath()).
And also, I want the canvas to draw it using animation at given frame rate or speed.
Anyone could give me a simple example or maybe some clue or anything that I can work with ?
Thanks !
You can find great example here:
http://www.jayway.com/2012/08/29/creating-custom-android-views-part-3-animating-your-custom-views-smoothly/
The sources are also there so it's very easy.
Your approach is good- you basically use Path.cubicTo in your View's onDraw and invalidate views while changing input coordinates. You can do it in another thread or create ValueAnimator and invalidate view in AnimatorUpdateListener.
I want to make android-screen as white-board so that by touch on screen I able to draw something on screen.
I know I have to use canvas, Path all these things. But how I can make that screen so that i able to draw a dot there?
For that what should i do with my activity?
How can I do that plz give me some sample code.
Thank you
So maybe you should take a look to this example:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.html
I'm trying to create a simple Pegs game. I have drawn the 15-hole board using canvas. I have been programming a while, but games are new to me and I'm stuck on what to do when it comes to handling the pegs. I want to only use the touch screen, but it seems like it is really difficult to touch the pegs and actually select them individually. I plan on just drawing everything programmatically. What is best way on handling this? Using buttons as place holders and changing the button image? Any help would be greatly appreciated.
To be very brief, you have to keep track of the things you draw on the canvas.
I wrote some tutorials for making and moving selectable shapes on the canvas. They should help a lot.
On android it might be a little different than using mousedown, but it should give you a very good starting place.
I don't know if this will help, but you might want to write your own onTouch()function. Check it out
I would like to design a layout for my android app which has imageviews/Textviews placed as shown in the figure below.
Right now, i tried to use Absolute layout, but i know that will create problems as the screen size changes.
Please help me with your ideas.
All comments are welcomed.
Thanks & Regards,
Sen
You should use 2D Graphics to draw shapes, 2D Graphics.
Hmm I think my approach will be to calculate some function that will model the curve (maybe two functions one for yellow and one for green 1/-x seems good) and then draw the circles with center coordinates like x = f(x). You can do this by simple implementing custom view and override onDraw method.