我在我的"插入照片框架"中使用Android中的相机像本教程一样应用 http://developer.android.com/guide/topics/media/camera.html 我在FrameLayout中有一个ImageView来插入一个图像框架,内部部分是透明的。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<FrameLayout
android:id="@+id/camera_container"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:gravity="top"
android:orientation="vertical" >
</FrameLayout>
<ImageView
android:id="@+id/grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/demo" />
</RelativeLayout>
</LinearLayout>
如何提取内部部件来自相机的帧图像?
答案 0 :(得分:0)
private static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 100;
private static final int CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE = 200;
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
// Image captured and saved to fileUri specified in the Intent
Toast.makeText(this, "Image saved to:\n" +
data.getData(), Toast.LENGTH_LONG).show();
} else if (resultCode == RESULT_CANCELED) {
// User cancelled the image capture
} else {
// Image capture failed, advise user
}
}
if (requestCode == CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
// Video captured and saved to fileUri specified in the Intent
Toast.makeText(this, "Video saved to:\n" +
data.getData(), Toast.LENGTH_LONG).show();
} else if (resultCode == RESULT_CANCELED) {
// User cancelled the video capture
} else {
// Video capture failed, advise user
}
}
}