如何在代码中创建圆环:

先看效果图

在代码中创建Drawable资源

代码;

import android.graphics.drawable.GradientDrawable;


        GradientDrawable circle = new GradientDrawable();
        circle.setSize(200, 200);//设置圆环宽高
        circle.setShape(GradientDrawable.OVAL);//设置形状为圆环
        circle.setColor(Color.TRANSPARENT);//设置圆环内部填充颜色
        circle.setStroke(10, Color.WHITE);//设置圆环宽度以及颜色
        circle.setGradientCenter(100, 200);//设置圆环中心点位置

 

相关文章:

  • 2022-02-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-28
  • 2021-06-06
  • 2022-12-23
  • 2022-02-18
  • 2022-12-23
相关资源
相似解决方案