📌  相关文章
📜  以编程方式设置形状半径的顶角 android - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:28.386000             🧑  作者: Mango

代码示例1
GradientDrawable shape =  new GradientDrawable();
 shape.setCornerRadius( 8 );

 // add some color
 // You can add your random color generator here
 // and set color
 if (i % 2 == 0) {
  shape.setColor(Color.RED);
 } else {
  shape.setColor(Color.BLUE);
 }

 // now find your view and add background to it
 View view = (LinearLayout) findViewById( R.id.my_view );
 view.setBackground(shape);