我想開發具有3個標籤的應用程序,從而使第一選項卡,相機和拍攝圖像。到目前爲止,我有兩個相機問題:激活相機標籤(Android)內
我希望相機鎖定在縱向或橫向模式。如果我將照相機鎖定在肖像上,那麼圖像似乎旋轉了,並且我幾乎用camera.parameters嘗試了所有內容,但無法修復它。如果我將相機鎖定在橫向模式,那麼問題在於選項卡菜單也會將方向改爲橫向。是否有方法只在該選項卡內更改方向,並將標籤菜單保留爲縱向模式?
圖像以某種方式被拉伸。我猜想問題在於相機使用全屏幕的高度和寬度,但是我的應用程序試圖將相機預覽放在比屏幕更小的框架佈局內,這是因爲選項卡菜單,所以圖像被拉伸。有沒有辦法解決這個問題,並顯示實際的相機預覽與標籤菜單上呢?
我使用1個活性創建該3個標籤,並使用此佈局:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_weight="1"/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"/>
</LinearLayout>
</TabHost>
我使用1個活性爲每個標籤。專門針對第一選項卡(照相機)我使用preview.class在以下佈置:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout" android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="wrap_content">
<FrameLayout android:layout_weight="1" android:id="@+id/preview" android:layout_gravity="fill_vertical" android:fitsSystemWindows="true" android:layout_height="wrap_content" android:layout_width="wrap_content">
</FrameLayout>
<Button android:text="Click" android:id="@+id/buttonClick" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center"></Button>
</LinearLayout>