Home java How to draw an arrow in Android

How to draw an arrow in Android

Author

Date

Category

How can you draw an arrow in Android


Answer 1, Authority 100%

Perhaps someone is useful to drawn arrogant:

Public Class Drawarrow Extends Activity {
@Override
PROTECTED VOID OnCreate (Bundle SavedInstanceState) {
Super.ONCREATE (SavedInstanceState);
SetContentView (New DrawView (this));
}
Class DrawView EXTENDS VIEW {
  Paint P;
  Public DrawView (CONTEXT CONTEXT) {
    Super (Context);
    P = New Paint ();
    P.Setstrokewidth (7);
    P.SetStyle (paint.style.fill_and_stroke);
  }
  @Override
  PROTECTED VOID ONDRAW (CANVAS CANVAS) {
    P.Setcolor (Color.Black);
    canvas.drawpath (MAKEARROW (200,100), P);
  }
}
Private Path MakeArrow (Float Length, Float Height) {// = Height / 2
  Path Path = New path ();
  path.reset ();
  path.moveto (0.0F, Height * 0.5f);
  Path.Lineto (Length, Height * 0.5f);
  Path.Lineto (Length * 0.97F, Height * 0.35f);
  Path.Lineto (Length * 1.2F, Height * 0.5f);
  Path.Lineto (Length * 0.97F, Height * 0.65f);
  Path.Lineto (Length, Height * 0.5f);
  path.close ();
  RETURN PATH;
 }
}

Answer 2, Authority 33%

and 9-patch than not like ???

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions