2 ответа
Возможно кому-то пригодится именно нарисованная стрелочка:
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;
}
}