回答

0

我認爲你的意思是說你想要一個用戶適合他們的照片的輪廓 - 例如,一個身體輪廓和用戶然後將他們正在拍攝的人合併到身體輪廓中(希望通過移動相機而不是毆打作爲照片主題的人!)。

假設是這種情況,那麼您可以在疊加在相機預覽頂部的圖像視圖上繪製輪廓。

您可以在您的佈局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>