/**
* Specifies the alignment of the canvas's text: center, normal
* (starting at the specified point in DrawText() or DrawAngle()),
* or opposite (ending at the specified point in DrawText() or
* DrawAngle()).
*
* @param alignment one of {@link Component#ALIGNMENT_NORMAL},
* {@link Component#ALIGNMENT_CENTER} or
* {@link Component#ALIGNMENT_OPPOSITE}
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_TEXTALIGNMENT,
defaultValue = DEFAULT_TEXTALIGNMENT + "")
@SimpleProperty(userVisible = true)
public void TextAlignment(int alignment) {
this.textAlignment = alignment;
switch (alignment) {
case Component.ALIGNMENT_NORMAL:
paint.setTextAlign(Paint.Align.LEFT);
break;
case Component.ALIGNMENT_CENTER:
paint.setTextAlign(Paint.Align.CENTER);
break;
case Component.ALIGNMENT_OPPOSITE:
paint.setTextAlign(Paint.Align.RIGHT);
break;
}
}
Canvas.java 文件源码
java
阅读 42
收藏 0
点赞 0
评论 0
项目:appinventor-extensions
作者:
评论列表
文章目录