Android Javacameraview与边界布局的全宽相同
Im使用以下代码在布局中显示摄影机视图Android Javacameraview与边界布局的全宽相同,android,opencv,javacameraview,Android,Opencv,Javacameraview,Im使用以下代码在布局中显示摄影机视图 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:opencv="http://schemas.android.com/apk/res-auto"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:opencv="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
android:orientation="vertical"
android:weightSum="2">
<RelativeLayout
android:id="@+id/cam_frame"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary">
</LinearLayout>
<org.opencv.android.JavaCameraView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
android:id="@+id/AddPersonPreview"
opencv:show_fps="false"
opencv:camera_id="any" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:background="@color/colorPrimary"
android:layout_weight="0">
</LinearLayout>
</LinearLayout>
我正试图让摄像头视图占据与摄像头框架
相同的全宽和全高。它占据了高度,但框架的宽度没有完全占据,因此在宽度旁边有一个黑色背景。我怎样才能解决这个问题?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:opencv="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/cam_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary">
</LinearLayout>
<org.opencv.android.JavaCameraView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
android:layout_margin="30dp"
android:id="@+id/AddPersonPreview"
opencv:show_fps="false"
opencv:camera_id="any" />
</RelativeLayout>
</LinearLayout>
我希望相机只占据屏幕的一部分,您可以使用边距。我只需在JavaCameraView
中添加边距属性。但很难理解你的布局。你可以发布usi的设计吗?我希望相机只占据屏幕的一部分,你可以使用边距。我只是在JavaCameraView
中添加了一个边距属性。但很难理解你的布局。你能帮我们把设计贴出来吗