2012-11-08 3 views
0

카메라 미리보기 프레임에 버튼을 드래그 앤 드롭했는데 장치에서 앱을 실행할 때 버튼이 표시되지 않으면 버튼이 표시되지 않습니다. 이 문제를 해결하는 데 도움을주십시오. 나는 카메라 미리보기에 플래시 버튼을 추가 할 수있다. 다음은 XML 코드입니다. 카메라에 버튼을 추가하는 방법 Android의 미리보기 프레임?

 <FrameLayout 
     android:id="@+id/camera_preview" 
     android:layout_width="fill_parent" 
     android:layout_height="0dip" 
     android:layout_weight="1.05" > 

     <Button 
      android:id="@+id/button1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/flash_button" /> 

    </FrameLayout> 

    <Button 
    android:id="@+id/button_capture" 
    android:text="@string/capture_button" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center" 
    /> 
</LinearLayout> 

답변

0

I think you need to change the LinearLayout ~ RelativeLayout.

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

<FrameLayout 
    android:id="@+id/camera_preview" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" > 
</FrameLayout> 

<FrameLayout 
    android:id="@+id/indicator" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:background="@drawable/ind" > 
</FrameLayout> 

<Button 
    android:id="@+id/button_switchcam" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/btn_switch_button" 
    tools:ignore="HardcodedText" /> 

<Button 
    android:id="@+id/button_capture" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_centerVertical="true" 
    android:background="@drawable/btn_capture_button" 
    tools:ignore="HardcodedText" /> 

</RelativeLayout> 
: 여기

내가 사용하고 작업 XML이다
관련 문제