10

Is there a way to subtract or "cut out" a shape from another shape in xml? I'd like to create a white square with a transparent circular hole in the center... mainly because I don't want to do a bitmap manipulation to make a circular image :).

Yes, I know this solution (How to create a circular ImageView in Android?) exists.

enter image description here

Community
  • 1
  • 1
loeschg
  • 29,961
  • 26
  • 97
  • 150
  • Try using [Path FillType even_odd](http://developer.android.com/intl/zh-cn/reference/android/graphics/Path.FillType.html) – Wenhui Apr 15 '15 at 02:32

1 Answers1

0

You cannot subtract part of a drawable, but you can do a little hack creating a circle that as the same color of your activity background and put it on top of your square using a FrameLayout.

Stack Diego
  • 1,309
  • 17
  • 43