如何以编程方式将半径添加到imageButton对象?
我检查了该网站上的现有主题,但找不到答案?
我想添加没有XML文件的半径
您可以使用GradientDrawable做到这一点。
GradientDrawable shape = new GradientDrawable();
shape.setCornerRadius(8);
ImageButton ivButton = (ImageButton) findViewById( R.id.ivbtn );
ivButton.setBackgroundDrawable(shape);
享受!!!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句