【问题标题】:Camera with pattern in androidandroid中带有图案的相机
【发布时间】:2017-06-19 22:18:54
【问题描述】:

如何打开带有机身图案的设备摄像头?让用户在图案中拍照。 图案应该是图像。

【问题讨论】:

    标签: android android-camera android-camera-intent android-camera2


    【解决方案1】:

    我认为您的意思是您想要一个轮廓,用户可以将他们的照片放入其中 - 例如身体的轮廓,然后用户将他们正在拍摄的人与身体轮廓相匹配(希望通过移动相机而不是攻击作为照片主题的人!)。

    假设是这种情况,那么您可以在覆盖在相机预览顶部的图像视图上绘制轮廓。

    您可以在布局 xml 文件中定义它 - 例如:

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/camera_frag"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <com.acme.vision.AutoFitTextureView
            android:id="@+id/texture"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentStart="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentTop="true" />
    
        <LinearLayout
            android:id="@+id/control"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentTop="true"
            android:background="@color/colorPrimaryTransparent"
            android:orientation="vertical">
    
            <Button
                android:id="@+id/picture_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:text="@string/picture_button_text" />
    
        </LinearLayout>
    
        <RelativeLayout
            android:id="@+id/tileview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentStart="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentTop="true"
            android:layout_toLeftOf="@+id/control"
            android:background="@android:color/transparent" >
    
            <ImageView
                android:id="@+id/body_image"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/body_image_tablet"
                android:layout_centerInParent="true" />
    
        </RelativeLayout>
    
    </RelativeLayout>
    

    【讨论】:

      猜你喜欢
      • 2012-01-25
      • 2017-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多