【发布时间】:2015-05-21 10:03:52
【问题描述】:
我怎样才能像这样创建圆形/椭圆形或圆角的相机预览(中间的圆圈应该是相机预览)?
伦敦图像用按钮和视图代表 UI 的其余部分,所以 它必须是可见的 整体,这就是为什么我不能使用像这样的解决方案添加 android:background 作为半径像这样的形状矩形:
<?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>
当我尝试将android:background 设置为 SurfaceView 的椭圆形 xml 时,它也不起作用:
<?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>
如果有可能以某种方式扩展 SurfaceView 并使用它,请问我应该重写什么?
【问题讨论】:
标签: android camera surfaceview preview