2016-08-31 7 views
1

Camera 2 APIを使用するアプリケーションを開発しようとしていますが、ボトムバーの高さを編集しようとすると問題が発生します。私はカメラとボトムバーの間の黒いスペースを取り除きたいと思います。また、カメラの高さを伸ばしたいと思います。Android Camera2 - カメラとボトムバーの間の黒いスペースを削除する

Google Camera2Basicの例に従っています。

enter image description here

私はこの問題を解決できますか?

ありがとうございました。

activity_camera.xml

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/container" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#000" 
    tools:context=".CameraActivity" /> 

fragment_camera2.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:foreground="?selectableItemBackground" > 

    <widgets.AutoFitTextureView 
     android:id="@+id/texture" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:layout_alignParentTop="true" /> 

    <FrameLayout 
     android:id="@+id/control" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:elevation="4dp" 
     android:paddingBottom="12dp" 
     android:paddingLeft="16dp" 
     android:paddingRight="16dp" 
     android:paddingTop="12dp" 
     android:background="@color/white" > 

     <ImageButton 
      android:id="@+id/picture" 
      android:layout_width="@dimen/ic_camera" 
      android:layout_height="@dimen/ic_camera" 
      android:layout_gravity="center" 
      android:background="@drawable/cam_circle_selector" 
      android:contentDescription="@string/description_info" 
      android:scaleType="fitXY" 
      app:srcCompat="@drawable/ic_action_capture" /> 

    </FrameLayout> 

</RelativeLayout> 
+0

xmlコードを入力してください。 –

+0

私はちょうどXMLコードを追加しました。 – BigNick

+0

FrameLayout内のpadding_topを調整してください –

答えて

0

あなたcamera_viewが少し低くなっ原因と黒の仕切りを削除しますアクションバーのバックを追加することができます。あなたがアクションバーを追加しない場合のstyles.xmlでは、

<style name="MaterialTheme" parent="android:Theme.Material.Light" /> 

で、このライン

<style name="MaterialTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen" /> 

を交換するには、AutoFitTextureViewまたはCamera2BasicFragmentクラスを変更する必要があります。

+0

ありがとう、私はCamera2BasicFragmentクラスを変更することをお勧めします。 – BigNick

+0

何を修正するのですか? –

+0

@BigNickあなたはこれに対する解決策を見つけることができましたか?それをどうやって共有することができますか? – manuelvsc

関連する問題