我正在尝试制作圆形的表面视图.我搜索了很多,但我找不到一个好的解决方案.我现在正在做的是,我将SurfaceView放入FrameLayout,然后将另一个View放在它上面,或者使用PNG蒙版,或者使用形状xml drawable.这里是
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="140dp"
android:layout_height="140dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#000"
android:orientation="vertical"
android:visibility="visible" >
<FrameLayout
android:id="@+id/videorecordview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_weight=".2" >
<SurfaceView
android:id="@+id/surfaceView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/rounded"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
但这不是一个好的解决方案,也不是完美的.我想将surfaceview自定义为圆形.任何帮助将非常感激.谢谢 :)