나는 안드로이드 용 카메라 응용 프로그램을 만들고 있습니다. 아래 그림처럼 내 카메라 미리보기를 원합니다. 내 카메라 미리보기를 4 부분 또는 여러 부분으로 나누고 싶습니다. 어느 한 날 열심히 노력하면 사전Android 맞춤형 카메라 미리보기?
1
A
답변
2
이
덕분에이
어떤 예 또는 튜토리얼을 찾는 데 도움이 될 수 있습니다, 나는 해결책을 찾아 냈다. Yeaahhhh !!!
camera.xml :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<FrameLayout
android:id="@+id/preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</FrameLayout>
<LinearLayout
android:id="@+id/imageViewLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1" >
<ImageView
android:id="@+id/img1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1" >
<ImageView
android:id="@+id/img2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/ic_launcher" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1" >
<ImageView
android:id="@+id/img3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1" >
<ImageView
android:id="@+id/img4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/ic_launcher" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/clickButton"
style="@android:style/Animation.Translucent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="@string/click" />
</RelativeLayout>
카메라 활동은 다음과 같이해야합니다 : 난 단지 당신이, 당신이 구현할 수있는 나머지 초점을 맞추어야 주요 부분이라고 생각 그 부분을 게시하고있다. 어딘가에 붙어 있다면 나 한테 물어봐. 먼저 당신이 당신의 활동에서 호출해야합니다
final Button clickButton = (Button) findViewById(R.id.clickButton);
clickButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
camera.takePicture(null, null, mPicture);
}
});
당신의 onPictureTaken()이 같아야합니다
/**
* This will be called after taking picture from camera.
*/
final transient private PictureCallback mPicture = new PictureCallback() {
/**
* After taking picture, onPictureTaken() will be called where image
* will be saved.
*
*/
@Override
public void onPictureTaken(final byte[] data, final Camera camera) {
OutputStream outStream = null;
try {
outStream = new BufferedOutputStream(new FileOutputStream(
mGetFile));
outStream.write(data); // Write the data to corresponding place.
((FrameLayout) findViewById(R.id.preview))
.setVisibility(View.GONE);
((LinearLayout) findViewById(R.id.imageViewLayout))
.setVisibility(View.VISIBLE);
final Options options = new Options();
options.inScaled = true;
options.inPurgeable = true;
// to scale the image to 1/8
options.inSampleSize = 8;
Bitmap imageBitmap = BitmapFactory.decodeByteArray(data, 0,
data.length, options);
ImageView image1 = (ImageView) findViewById(R.id.img1);
ImageView image2 = (ImageView) findViewById(R.id.img2);
ImageView image3 = (ImageView) findViewById(R.id.img3);
ImageView image4 = (ImageView) findViewById(R.id.img4);
image1.setImageBitmap(imageBitmap);
image2.setImageBitmap(imageBitmap);
image3.setImageBitmap(imageBitmap);
image4.setImageBitmap(imageBitmap);
} catch (FileNotFoundException e) {
camera.release();
} catch (IOException e) {
camera.release();
} finally {
try {
outStream.close();
} catch (IOException e) {
camera.release();
}
}
}
};
이 위에서 언급 한 것과 같은 캡처 한 이미지를 표시합니다.
고맙습니다.
+0
여기에서 미리보기에 4 개 이상의 이미지가 필요하면 GridLayout을 더 잘 사용하십시오. 선형 레이아웃을 관리하는 것은 약간 복잡한 작업입니다. – Shrikant
관련 문제
- 1. 맞춤형 카메라 Andorid 미리보기 그림이 사진과 다릅니다.
- 2. 맞춤형 카메라 android
- 3. 표면보기가있는 Android 카메라 미리보기
- 4. android 카메라 미리보기
- 5. Android - 카메라 미리보기
- 6. Android :: Xoom : 카메라 미리보기 오리엔테이션
- 7. android 카메라 미리보기 빈 화면
- 8. Android - 전면 카메라 미리보기 SurfaceView
- 9. Android 에뮬레이터 카메라 미리보기 크기
- 10. Android 카메라 애플리케이션, 미리보기 충돌
- 11. Android 앞면 카메라 미리보기 크기
- 12. 모노 도이드 카메라 + 미리보기
- 13. 줌 카메라 SurfaceView - 미리보기
- 14. 안드로이드 카메라 맞춤형 품질
- 15. Android 카메라 미리보기 바이트 [] ~ Java 이미지
- 16. 720p Android 카메라 미리보기 데이터를 얻는 방법?
- 17. Android : 카메라 미리보기 위젯을 만드는 방법?
- 18. 4.1에서 Android 카메라 미리보기 콜백이 호출되지 않았습니다.
- 19. Android 카메라 미리보기 프레임 타임 스탬프
- 20. in android,보기로 스트림 카메라 미리보기
- 21. Android 카메라 미리보기 : 1 : 1 화면비, 어떻게?
- 22. 카메라 미리보기 예제
- 23. 표면보기에서 안드로이드 카메라 미리보기
- 24. iPhone : 카메라 미리보기 받기
- 25. iPhone에서 맞춤 카메라 미리보기?
- 26. 안드로이드에서의 카메라 미리보기 처리
- 27. 안드로이드 카메라 미리보기 튜토리얼
- 28. 카메라 미리보기 - 안드로이드
- 29. 카메라 미리보기 크기 조정
- 30. 카메라 미리보기 필터링
네 부분으로 무엇을 원하십니까? – Shrikant
내 카메라 표면에서 네 부분으로 나누어 진 미리보기를 원할 때 찍은 사진을이 효과와 함께 저장합니다. –