android - 在 Android 上构建圆框相机
问题描述
我已经为android构建了一个相机应用程序。我面临的问题是使相机框架变为圆形而不是方形或全屏。我试图使布局将其形状更改为圆形,但它没有用。布局是->
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:layout_width="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="#541358">
<FrameLayout android:layout_width="350dp"
android:layout_height="350dp"
android:layout_gravity="center"
android:background="@drawable/backshape"
android:id="@+id/container">
</FrameLayout>
</LinearLayout>
很感谢任何形式的帮助。
解决方案
你的框架布局可以是这样的
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<SurfaceView
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/backShape"></View>
</FrameLayout>
推荐阅读
- android - Android - 如何在网格布局中包含的按钮上添加 ImageView
- docker - Kubectl 命令挂起无法删除 pod
- java - 如何避免 java.util.ConcurrentModificationException
- javascript - Jest 不会转换 node_module 依赖项
- laravel - Livewire:绑定一个模型,前面可以看到所有字段吗?
- python - 需要帮助合并所有结果
- c# - :'不能在不可变对象实例上为'Fill.Color'设置动画。'
- google-sheets - 如何通过 Google Docs API 插入嵌入式工作表?
- mysql-workbench - MySQL工作台:多个窗口
- odoo-13 - 在销售订单中修改商品价格时的问题 (Odoo 13)