Android自定义视图绘图质量不佳

时间:2015-12-22 13:40:43

标签: android view override ondraw

我在Android上覆盖View来做一些自定义绘图,但渲染的视图质量不是很好,尤其是文本。我找到了几个解决方案,但没有一个适合我。在这里附加代码。谢谢你的帮助。

import flash.events.Event;
import flash.events.MouseEvent;
import fl.motion.MotionEvent;

function init() {
    Mouse.hide();

    // this creates an instance of the library MovieClip with the
    // name, "MyCursorClass".  this contains your mouse cursor art
    //
    Cursor = new CursorClass();
    Cursor.mouseEnabled = false;
    Cursor.visible = false;

    // you'll want to make sure the child is added above everything
    // else, possibly in its own container
    //
    addChild(Cursor);

    // respond to mouse move events
    stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
    stage.addEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler);
    stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}

function mouseMoveHandler(evt: MouseEvent): void {
    // whenever the mouse moves, place the cursor in the same spot
    Cursor.visible = true;
    Cursor.x = evt.stageX;
    Cursor.y = evt.stageY;
    // for smoother mouse pointer
    evt.updateAfterEvent();
}

function mouseLeaveHandler(evt: Event): void {
    Cursor.visible = false;

}

function mouseDownHandler(evt: MouseEvent): void {
    Cursor.gotoAndStop(xx);
}

function mouseUpHandler(evt: MouseEvent): void {
    Cursor.gotoAndStop(xx);
}

init();

1 个答案:

答案 0 :(得分:1)

尝试设置textpaint.setAntiAlias(true);