且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是否有可能掩盖Android的视图?

更新时间:2023-11-10 16:26:04

是的,它是 - 你必须重写视图的绘制方法 - 即:

Yes, it is - you have to override the drawing method of your view - i.e:

......
final Path path = new Path();
path.addRoundRect(new RectF(0,0,getWidth(),getHeight()),10,10,Direction.CW);
......
@Override
protected void dispatchDraw(Canvas canvas){
    canvas.clipPath(path);
    super.dispatchDraw(canvas);
}

这将吸引你的看法只有在边界由路径设置的。

this will draw your view only in the boundaries set by path.