Canvas.java 文件源码

java
阅读 42 收藏 0 点赞 0 评论 0

项目:appinventor-extensions 作者:
/**
 * 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;
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号