1

I'm trying to build a simple drawing app on Android and I was wondering if anyone has a direction how to add the following elements:

  1. A wavy simple line (Like this).
  2. A simple arrow.
  3. A dotted arrow.
  4. An arrow like a "T".

Thanks!

1 Answers1

0

Take a look here for arrowheads:

For simple lines:

PathEffect myPathEffect = new PathEffect();

paint.setPathEffect(myPathEffect);

Read documentation here.

Given your sample, however, I'm thinking you're going to have to construct paths point by point. Whatever the effect you're trying to achieve, you're going to have to do a bit of mathematics to plot your line. The example of a wavy line that you provided is anything but "simple" given its irregularity.

Community
  • 1
  • 1
MarsAtomic
  • 10,436
  • 5
  • 35
  • 56
  • Thanks!! Is PathEffect can help me in all the elements I mentioned? :) – user1836560 Jun 14 '13 at 01:57
  • See edited answer. You can achieve all of your effects, provided you are willing to do the legwork and use Graphics2D to draw what you want. I'm afraid SO isn't the place to ask for packaged solutions. – MarsAtomic Jun 14 '13 at 04:06