私はターゲット レベル 2.1 の Android カメラ アプリに取り組んでいますが、フル スクリーン モードに入るときに難しいと感じました。プレビュー中にボタンを表示したいのですが、実際には非表示になっています。
これはこのウェブサイトで見つけたコードで、少し変更して ください http://marakana.com/forums/android/examples/39.html
Preview preview;
Button buttonClick;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cameralayout);
preview = new Preview(this);
((FrameLayout) findViewById(R.id.preview)).addView(preview);
setContentView(R.layout.cameralayout);
buttonClick = (Button) findViewById(R.id.buttonClick);
buttonClick.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
preview.camera.takePicture(shutterCallback, rawCallback, jpegCallback);
}
});
Log.d(TAG, "onCreate'd");
}
これはxmlです
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/buttonClick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|bottom"
android:text="Click" />
</FrameLayout>
マニフェストはテーマを設定して全画面表示にします
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
それで、全画面プレビューのプレゼントで私のボタンを見えるようにする方法どうもありがとうございました〜