2013-07-11 5 views
0

카메라의 출력 위에 GLSurfaceView를 배치하고 그 위에 그림을 그립니다. 그런 다음GLSurfaceView는 UI 위젯을 숨 깁니다.

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/relativeLayout1" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" > 
<SurfaceView 
    android:id="@+id/cameraPreview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" /> 

<TextView 
    android:id="@+id/nearest_place_label" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" 
    android:textColor="#000" 
    android:textSize="30sp" 
    android:text="@string/empty" /> 

</RelativeLayout> 

내가 프로그래밍 GLSurfaceView 추가 :

public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_bigarrow); 
      //... 
    cameraPreview = (SurfaceView) findViewById(R.id.cameraPreview); 
    mGLView = new MyGLSurfaceView(this); 
    addContentView(mGLView, new LayoutParams(LayoutParams.MATCH_PARENT, 
      LayoutParams.MATCH_PARENT)); 
    previewHolder = cameraPreview.getHolder(); 
    previewHolder.addCallback(surfaceCallback); 
    previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); 

    nearestPubLabel = (TextView) findViewById(R.id.nearest_place_label); 
    nearestPubLabel.setText(R.string.bigarrow_searching); 
    nearestPubLabel.setVisibility(View.VISIBLE);//clutching at straws 

} 

GLSurfaceView 떨어져 화면의 작은 영역에서, 투명, 그리고 내가 볼 수있는 나는 서피스 뷰 SurfaceView와 텍스트 뷰를 포함하는 일반 레이아웃이 그것 밑에 카메라 미리보기. 그러나 내 TextView 표시되지 않습니다. 이 설정을 일반보기로 설정하면 TextView가 표시됩니다.

답변

0

addContentView을 사용하는 대신 XML에서 GLSurfaceView를로드하면 TextView가 표시됩니다. 이전 접근 방식의 문제점을 설명하지는 않지만 지금은 만족합니다.

관련 문제