2011-10-12 24 views
9

Chcę zapytać, praca z dwoma lub więcej zagnieżdżonymi RelativeLayout. Pierwszy kod wygląda jak obrazek 1, kiedy dodam android:layout_alignParentRight="true" w drugim RelativeLayout, wygląda to jak obraz 2. Chcę wyrównać tekst do drugiego RelativeLayout. Gdzie moja wina?dwa lub więcej zagnieżdżonych 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> 

Zdjęcie 1:

Picture 1

I dodam 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> 

Zdjęcie 2:

Picture 2

+0

spróbować dodać do '' TextView' Androida: layout_alignParentTop = "true" ' –

+0

najgorszy scenariusz: Dodaj' ImageView' przed 'TextView' zamiast z 'android: background =" @ drawable/picture_border_offer_first_page "'. Będą nakładać się –

+0

@pierw wypróbowałem alightTop, to samo. – atasoyh

Odpowiedz

4

To pytanie jest bez odpowiedzi. kiedy zaktualizowałem wersję ADT, ten problem został rozwiązany. Myślę, że był jakiś błąd.

Proponuję sprawdzić wersję ADT czasami ...

+2

także inna wskazówka, nie zawsze aktualizuj ADT wersja! , ponieważ nowsze wersje są dostarczane z nowszymi błędami! zawsze powinieneś testować adt na innym IDE Eclipse. – meh

+0

@meh - tak, masz rację. – atasoyh

0

W pierwszym RelativeLayout masz:

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

Prawdopodobnie chcesz:

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

próbowałem, również mój aparat tła jest wystarczająco duży ... – atasoyh

Powiązane problemy