Android: How to make a circular view of the camera?

How can I create a circular / oval or rounded camera angle (this circle in the middle should be the camera view)?

enter image description here

The London image is the rest of ui with buttons and views, so it must be visible in its entirety, and therefore I cannot use solutions like add android:background as a rectangle of shape with a radius like this

 <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#FFFFFF"/> <stroke android:width="3dip" android:color="#B1BCBE" /> <corners android:radius="50dip"/> <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" /> </shape> 

and when I try to set android:background as oval xml in SurfaceView, it doesn't work either:

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <size android:width="120dp" android:height="120dp"/> <stroke android:color="#FF000000" android:width="2dp" /> </shape> 

If you can somehow extend the SurfaceView and use it, what should I rewrite please?

+6
source share
1 answer

hmm I think the easiest way is to put imageView on top of SurfaceView xml example:

 <RelativeLayout ....> <SurfaceView ... /> <ImageView ... /> </RelativeLayout> 
0
source

Source: https://habr.com/ru/post/983968/


All Articles