相机圆形窗口预览
言不如一图...
如果老铁还可以,不用请我和阔乐,不入就给我的个小星星 O_O
Quick Start
引入依赖
implementation 'com.github.cliven.circlecamerapreview:circlecamerapreview:1.0.4'
引用依赖Gralde 4.0以前版本
compile 'com.github.cliven.circlecamerapreview:circlecamerapreview:1.0.4'
在xml中引用组件
android:layout_width="400dp"
android:layout_height="400dp"
android:background="@android:color/transparent" />
注意:
width 和 height 比例必须尽可能为 1:1,在真正绘制时可能会动态调整 width 和 height
background 必须设置,某则无法显示圆形,建议设置为透明@android:color/transparent
AndroidManifest.xml 加入相机使用权限
确保程序在调用时能够授权
private static final String[] NEEDED_PERMISSION = {Manifest.permission.CAMERA};
if (ContextCompat.checkSelfPermissio