2013-03-03 3 views
0

상대 레이아웃 안에 상대 레이아웃 안에 상대적 레이아웃이 있습니다. 이미지 뷰와 glsurface가 그 위에 쌓여 있고, glsurface가 imageview와 동일한 크기를 갖고 싶습니다. 어떻게이 작업을 수행합니까 ??안드로이드 상대 레이아웃 어린이 크기

  <RelativeLayout 
         android:layout_width="fill_parent" 
         android:layout_height="fill_parent"> 

       <com.zibi.ResizableImageView 
            android:id="@+id/imageView1" 
            android:layout_width="fill_parent" 
            android:layout_height="fill_parent" 
            android:layout_weight="1.0" 
            android:gravity="center_horizontal" 
            android:src="@drawable/notepad" /> 

       <com.zibi.zGLSurfaceView android:id="@+id/surfaceviewclass" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent"> 

       </com.zibi.travelersnotepad.zGLSurfaceView> 
      </RelativeLayout> 

답변

0

시도합니다. TextView는 ImageView를 커버합니다. More about relative layout attributes

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 
    <ImageView 
     android:id="@+id/img" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/image" 
     android:scaleType="fitXY"/> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="#AFFF" 
     android:layout_alignRight="@+id/img" 
     android:layout_alignLeft="@+id/img" 
     android:layout_alignTop="@+id/img" 
     android:layout_alignBottom="@+id/img" 
     android:text="sample text"/> 
</RelativeLayout> 
0

RelativeLayout을 사용하여 내부의 하위보기에 크기 속성을 적용 할 수 없습니다. 당신이 그것을 위해 특히 필요가 해달라고하면 , 당신은있는 LinearLayout을 대신 사용하고 모두보기 같은 무게 제공 할 수 있습니다 : layout_align* 속성을 설정하는

  <LinearLayout 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"> 

      <com.zibi.ResizableImageView 
           android:id="@+id/imageView1" 
           android:layout_width="fill_parent" 
           android:layout_height="fill_parent" 
           android:layout_weight="1.0" 
           android:gravity="center_horizontal" 
           android:src="@drawable/notepad" /> 

      <com.zibi.zGLSurfaceView android:id="@+id/surfaceviewclass" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_weight="1.0"> 

      </com.zibi.travelersnotepad.zGLSurfaceView> 
     </LinearLayout> 
+0

, 당신은 linear_layout에서 다른 상단에 하나 개의보기를 쌓아 캔트 "내가 그 위에 쌓인 이미지보기 및 glsurface이"내가 상대를 사용하고 왜 그게 전부, 그리고 난 같은 크기로 glsurface합니다 이미지 뷰로 – ZZZ

관련 문제