我需要显示一个需要有圆形边界的 View 。 我知道这可以通过扩展 RelativeLayout 来完成。但确切地不知道除了构造函数之外要覆盖哪些所有方法以及我必须对其进行哪些代码更改才能显示圆形边界。
用图像更新了问题。 所以基本上这是一个动画。 并且 View 从圆周的圆周处从屏幕上消失(而不是矩形 View )。 所以我必须创建一个圆形 View (相对布局),它是这些图像的 subview 。
最佳答案
使用 android.support.v7.cardview
并放置一个 RelativeLayout
作为它的 child 。
https://developer.android.com/reference/android/support/v7/widget/CardView.html
上面链接的注释:
Due to expensive nature of rounded corner clipping, on platforms before L, CardView does not clip its children that intersect with rounded corners. Instead, it adds padding to avoid such intersection (See setPreventCornerOverlap(boolean) to change this behavior).
关于android - 自定义 RelativeLayout 以具有圆形边界,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29506004/