2012-06-30 3 views

답변

1

이 레이아웃을 사용하여 image의 왼쪽 위 모서리에 2 개의 buttons을 두십시오.

<RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
     <ImageView 
      android:src="@drawable/ic_launcher" 
      android:layout_alignTop="true" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_alignBottom="true"/> 
     <Button 
      android:id="@+id/buttonLeft" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentTop="true"/> 
     <Button 
      android:id="@+id/buttonRight" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_toLeftOf="@id/bbuttonLeft"/> 

    </RelativeLayout> 
+0

정답으로 표시되었지만 중복 된 layout_width 속성을 찾았습니다. – ppshein

+0

감사합니다. 수정 됨. :) –

1

ImageView을 사용하면 Layout을 사용하고 배경을 설정할 수 있습니다. 원하는대로 단추를 넣으십시오.

사용을 고집 경우 ImageView

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

    <ImageView 
     android:layout_height="match_parent" 
     android:layout_width="match_parent"/> 
    <!-- put the buttons in here as you like --> 

</RelativeLayout> 
1

감싸고 ImageView`안드로이드 RelativeLayout에 사용할 : layout_alignTop = "@ + ID/이미지 뷰".

관련 문제