2011-10-13 7 views
2

下のコードで示すように、重複したいImageViewが2つありますが、大きい方は体系的に小さい方の下に配置されています。両方ともアンドロイドです:layout_alignParentTopが "true"に設定されていれば、重なり合っているが、アンドロイドはそれらを互いに下に置いている。RelativeViewでオーバーラップするImageView

<RelativeLayout android:id="@+id/RelativeLayout1" 
     android:layout_width="wrap_content" android:layout_height="wrap_content" 
     android:layout_gravity="center_vertical|center_horizontal" 
     android:gravity="center_horizontal|center_vertical"> 
     <ImageView android:id="@+id/homeStars" android:src="@drawable/background" 
      android:layout_height="wrap_content" android:layout_width="fill_parent" android:scaleType="centerInside" 
      android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:layout_alignParentTop="true" 
      /> 
     <ImageView android:id="@+id/homeLogo" android:src="@drawable/logo" 
      android:layout_height="wrap_content" android:layout_width="220dip" 
      android:layout_alignParentTop="true" android:layout_centerHorizontal="true" 
      android:paddingTop="2dip" /> 
</RelativeLayout> 

注1:最初のものを相対的なビューのバックグラウンドとして設定することは望ましくありません。 注2:この相対レイアウトがScrollView内に配置されていると付け加えるべきです。

+0

あなたは今問題が重なっています...?そしてあなたは何をしたいのですか? – Graeme

+0

私はそれらが重なり合ってほしい – AsTeR

+0

もし誰かが後ろにいるなら...どのように重なり合っていないのですか? – Graeme

答えて

4
<RelativeLayout 
    android:id="@+id/RelativeLayout1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 

    <ImageView 
     android:id="@+id/homeStars" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:scaleType="centerInside" 
     android:src="@drawable/background" /> 

    <ImageView 
     android:id="@+id/homeLogo" 
     android:layout_width="220dip" 
     android:layout_height="wrap_content" 
     android:paddingTop="2dip" 
     android:src="@drawable/logo" /> 

</RelativeLayout> 

他のレイアウトタグがすべて削除されていて、うまくいきます。当然のことながら、すべての子供は、RelativeLayoutの左上に自分自身を配置することによってお互いに重なります。あなたは余分なタグは、私だけでなくパーサと混同していました。上記のコードをコピーして、次回に徐々に変更してください! :)

+0

RelativeLayoutのpositionningディレクティブはそれを混乱させました。増分プロセスは機能しますが、時間がかかります。ありがとう。 – AsTeR

0

お試しくださいrelated post FrameLayoutは、RelativeLayoutに非常に熱心であるように見えますが、ジョブを完了します。あなたのために妥協は可能ですか?

関連する問題