7

My requirement is similar (not the same, of course) to the GuitarTuna app. I want to draw on an infinite vertical ScrollView as follows:

enter image description here

A trail emanating from the bottom of the pin on the top of the screen can be seen in the image above. It keeps scrolling with the ScrollView and disappears (by scrolling out of the screen) if the drawing is stopped.

What is the best way to create a similar kind of drawing interface?

androidnoob
  • 345
  • 2
  • 17

1 Answers1

1

EDITED

Hi!

Finally, i think, i understand what you need. I really don't know if is possible to achieve by this using the example that you mention.

I would try the option of using a SurfaceView. Here's what i have until now:

An interesting answer about how to draw inside scrollView:

How to draw on canvas greater than screen size and be able to scroll / pan horizontally and vertically in android?

How to draw in a SurfaceView: example 1 example 2

Complete example of draw using TouchListener in a SurfaceView

How to draw to Canvas from SurfaceView?

Good answers that explains how a SurfaceView works :

Android: How to draw on a Surfaceview which already is displaying a Camara Preview View and SurfaceView, which one is better?

Ideas on how to scroll a surfaceView?

Android SurfaceView scrolling

I wish to have more time to help you, and change my answer with some code.

Hope it helps!

noe
  • 794
  • 8
  • 13
  • Thanks for the answer, I truly appreciate the effort. But, my use case is a bit different. What I want to make here is a live plotter like application. I want to draw real time data. There are libraries for that but the disadvantage with them is that they plot the data before scrolling. Whereas in my case, I literally want to draw. Imagine a canvas that is scrolling vertically in front of you and you have a pen that you can move only horizontally. I suggest that you try using GuitarTuna once to get the exact idea. – androidnoob Jul 13 '17 at 05:39
  • I saw the effect in the app, i think that @wrkwrk 's comment is the correct way. I'll try to edit my answer with something that really helps you. Can you provide examples of the libraries that you mention? – noe Jul 13 '17 at 14:00
  • Sure, there's this library that does it: http://www.android-graphview.org/realtime-chart/ – androidnoob Jul 13 '17 at 14:03
  • Well, with the limited time I had, I finally succeeded in implementing what I wanted using a NestedScrollView, and drawing on the canvas of a custom View which is inside the NestedScrollView. I will post the code in a day or two. – androidnoob Jul 14 '17 at 08:39
  • For those who might question why I have accepted this answer: I am accepting this answer for the sincere effort, the spirit of helping someone out, and the direction that it provided me on the basis of which I was able to get my work done. – androidnoob Jul 14 '17 at 08:40