如何绘制的ImageView Android上线? [英] How to draw a Line in ImageView on Android?

查看:114
本文介绍了如何绘制的ImageView Android上线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何绘制线路上的ImageView为用户刷卡自己的手指?

I'd Like to know how to draw a Line on ImageView as user swipe their finger ?

难道任何机构解释一下吗?或许任何一个环节得到开始进行这项工作。

Could any body explain this ? Or perhaps any Link to get start on this.

推荐答案

您必须拥有自己的ImageView并覆盖OnDraw函数。使用这样的事情

You must have your own ImageView and override onDraw function. Use something like this

public class MyImageView extends ImageView{

    public MyImageView(Context context) {
        super(context);
        // TODO Auto-generated constructor stub
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
        canvas.drawLine(0, 0, 20, 20, p);

    }

}

和在主类中创建对象 MyImageView ;当你触摸显示器调用更新(); 功能

and in your main class create object MyImageView; and when you touch your display call the update(); function

这篇关于如何绘制的ImageView Android上线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆