ButtonBase.java 文件源码

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

项目:appinventor-extensions 作者:
private void setShape() {
  ShapeDrawable drawable = new ShapeDrawable();
  // Set color of drawable.
  drawable.getPaint().setColor((backgroundColor == Component.COLOR_DEFAULT)
                               ? SHAPED_DEFAULT_BACKGROUND_COLOR : backgroundColor);
  // Set shape of drawable.
  switch (shape) {
    case Component.BUTTON_SHAPE_ROUNDED:
      drawable.setShape(new RoundRectShape(ROUNDED_CORNERS_ARRAY, null, null));
      break;
    case Component.BUTTON_SHAPE_RECT:
      drawable.setShape(new RectShape());
      break;
    case Component.BUTTON_SHAPE_OVAL:
      drawable.setShape(new OvalShape());
      break;
    default:
      throw new IllegalArgumentException();
  }
  // Set drawable to the background of the button.
  view.setBackgroundDrawable(drawable);
  view.invalidate();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号