1
次のコードを使用して、レイアウト内のカメラビューを表示します。境界線のレイアウトと同じ幅のJavacameraview
cam_frame
のような全幅と全高を占めるようにカメラビューを持ってしようとしている
<?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>
イム。それは高さを占めるが、フレームの幅は完全に占有されていないので、幅の横に黒い背景がある。どのようにこれを整理することができますか?
カメラが画面の一部だけを占有したい場合 –
余白を使用できます。 –
margin?......... –