2011-10-12 15 views
9

2つ以上の入れ子になったRelativeLayoutを使用して作業しています。 最初のコードは画像1のようになります。android:layout_alignParentRight="true"を2番目のRelativeLayoutに追加すると、画像2のようになります。2番目のRelativeLayoutにテキストを正しく配置したいと思います。私の欠点はどこですか?2つ以上の入れ子のRelativeLayout

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="wrap_content" 
     android:background="@drawable/background" 
     android:layout_height="wrap_content" 
     android:id="@+id/testRL"> 
     <RelativeLayout 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight="true" 
       android:layout_alignParentTop="true" 
       android:id="@+id/testRotateLL" 
       android:background="@drawable/picture_border_offer_first_page"> 
       <TextView 
         android:layout_height="wrap_content" 
         android:layout_width="wrap_content" 
         android:text="7000TL" 
         android:textSize="15sp" 
         android:textColor="@android:color/white" 
         android:id="@+id/amountLayoutTV" /> 
     </RelativeLayout> 
</RelativeLayout> 

写真1:

Picture 1

そして、私は追加android:layout_alignParentRight="true"

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:background="@drawable/background" 
    android:layout_height="wrap_content" 
    android:id="@+id/testRL"> 
    <RelativeLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:id="@+id/testRotateLL" 
      android:background="@drawable/picture_border_offer_first_page"> 
      <TextView 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:text="7000TL" 
        android:layout_alignParentRight="true" 
        android:textSize="15sp" 
        android:textColor="@android:color/white" 
        android:id="@+id/amountLayoutTV" /> 
    </RelativeLayout> 
</RelativeLayout> 

写真2:

Picture 2

+0

は 'TextView''アンドロイドに追加しよう:layout_alignParentTopは= ' "真" –

+0

最悪のシナリオ:代わりにTextView''の前に 'ImageView'を追加します。 'android:background =" @ drawable/picture_border_offer_first_page "のようになります。彼らはオーバーレイされます –

+0

@最初私はalightTopを試してみました。 – atasoyh

答えて

4

この質問は未回答です。私がADTバージョンを更新したとき、この問題は解決しました。バグがあったと思う。

私はあなたが時々ADTのバージョンを確認することをお勧め...

+2

また別のヒントは、バージョン! 新しいバージョンにはより新しいバグがあるため!別のEclipse IDE上でadtを常にテストする必要があります。 – meh

+0

@meh - はい、そうです。 – atasoyh

0

あなたが持っている最初のRelativeLayoutで:

android:layout_width="wrap_content" 
android:layout_height="wrap_content" 

あなたはおそらくしたい:

android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
+0

私はそれを試しました。また、私の背景ımageは十分に大きいです... – atasoyh

関連する問題