2013-09-25 2 views
0

나는 ImageView를 통해 ImageView를해야만하고, 같은 크기를 가지며 똑같은 장소에서 다른 것과 똑같이 있어야하고, 때때로 3 개의 ImageViews가 켜져 있어야합니다. 서로의 상단. 누구든지 이것이 어떻게 이루어져야하는지 알 수 있습니까?안드로이드의 ImageView를 통한 ImageView

답변

1

이렇게하면 3 개의 이미지가 서로 중첩됩니다.

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

    <ImageView 
      android:layout_width="<some_size>dp" 
      android:layout_height="<some_size>dp" 
      android:layout_alignParentTop="true" 
      android:src="@drawable/<name_of_asset>" /> 
    <ImageView 
      android:layout_width="<some_size>dp" 
      android:layout_height="<some_size>dp" 
      android:layout_alignParentTop="true" 
      android:src="@drawable/<name_of_asset>" /> 
    <ImageView 
      android:layout_width="<some_size>dp" 
      android:layout_height="<some_size>dp" 
      android:layout_alignParentTop="true" 
      android:src="@drawable/<name_of_asset>" /> 


</RelativeLayout> 
+0

다른 이상 될 것 OUTPUT? 나는 두 번째가 첫 번째와 세 번째가 모두를 덮을 것임을 의미합니까? – Sasho

+0

Android에서 레이아웃에 정의 된 첫 번째 항목은 항상 다음 항목 아래에 위치합니다. –

1

RelativeLayout 또는 FrameLayout을 사용하면 n은 ImageViews 일 수 있습니다. 그것을 하나 아래에 선언하면 서로를 덮을 것입니다. 처음 선언 된 것은 두 번째 선언 된 것 뒤에 있습니다.

0

시험해보기 : 필요에 맞게 조정하십시오.

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

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentTop="true" 
    android:src="@drawable/ic_launcher" /> 

<ImageView 
    android:id="@+id/imageView2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentTop="true" 
    android:src="@drawable/ic_launcher" /> 

<ImageView 
    android:id="@+id/imageView3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentTop="true" 
    android:src="@drawable/ic_launcher" /> 

<ImageView 
    android:id="@+id/imageView4" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" 
    android:src="@drawable/ic_launcher" /> 

enter image description here

관련 문제