小编use*_*512的帖子

如何在android中使用ShapeDrawable以编程方式创建圆角边框?

我需要通过扩展ShapeDrawable以编程方式创建带圆角的边框.我需要一个带圆角的黑色边框,外面的像素是白色,内部像素是透明的.我目前的代码存在多个问题,其中的问题是它不会创建一个与边框厚度相同的平滑角,并且边框的外部像素是透明的而不是白色.

这是我目前得到的角落的图片 角

这是我在构造函数中为'fill'传递Color.TRANSPARENT的代码:

public class CustomShape extends ShapeDrawable {
 private final Paint fillpaint, strokepaint;
public CustomShape(int fill, int strokeWidth,int radius) {

    super(new RoundRectShape(new float[] { radius, radius, radius, radius, radius, radius, radius, radius }, null, null));
    fillpaint = new Paint(this.getPaint());
    fillpaint.setColor(fill);
    strokepaint = new Paint(fillpaint);
    strokepaint.setStyle(Paint.Style.STROKE);
    strokepaint.setStrokeWidth(strokeWidth);
    strokepaint.setColor(Color.BLACK);
}



@Override
protected void onDraw(Shape shape, Canvas canvas, Paint paint) {
    shape.draw(canvas, fillpaint);
    shape.draw(canvas, strokepaint);
}
Run Code Online (Sandbox Code Playgroud)

}

java android border drawable shapedrawable

16
推荐指数
2
解决办法
2万
查看次数

为什么iOS7模拟器中缺少提醒应用程序

嗨,我有一个应用程序,使用提醒应用程序设置提醒与警报,但问题是,在iOS7模拟器上没有提醒应用程序的应用程序图标,所以我无法打开它,看看是否已设置提醒.有没有其他人有这个问题或有人知道如何解决它?

谢谢

reminders ios ios-simulator

5
推荐指数
0
解决办法
733
查看次数

如何在C#中存储类列表?

在Java中,我可以有一个类列表,如:

List<Class>
Run Code Online (Sandbox Code Playgroud)

但是我如何在C#中做到这一点?

c# generics reflection class list

4
推荐指数
1
解决办法
3865
查看次数