2011-10-11 7 views
6

Potrzebuję obrócić układ (ma TextView i ImageView) i powinien zostać umieszczony wyrównanie w prawo i na górze w RelativeLayout. Tworzę swój układ, ten układ jest umieszczony na prawo-górze. Ale jeśli go obrócę, nie mogę ustawić w prawo. Co powinienem zrobić?Obracanie układu i po umieszczeniu w względnym interfejsie prblem

mój krewny Układ

<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"> 

       <ImageView 
         android:layout_height="wrap_content" 
         android:layout_width="wrap_content" 
         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:layout_centerInParent="true" 
         android:textColor="@android:color/white" 
         android:id="@+id/amountLayoutTV" /> 
     </RelativeLayout> 
</RelativeLayout> 

I obrócić tę linearLayout z animacją. To obraca dobry ..

<rotate 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:fromDegrees="0" 
     android:toDegrees="45" 
     android:pivotX="50%" 
     android:pivotY="50%" 
     android:fillEnabled="true" 
     android:detachWallpaper="true" 
     android:duration="0" 
     android:fillAfter="true"> 
</rotate> 

Po Obrót nowy visial jest .. enter image description here

Odpowiedz

0

Kiedy zmodernizowane moim ADT, ten problem rozwiązał się sam. Myślę, że wystąpił błąd w układzie graficznym ADT.

1

Jaka wersja android używasz?

W nowszych wersjach można po prostu umieścić układy krajobrazu w specjalnym folderze. Po prostu utwórz nowy folder o nazwie "układ-land" w swoim folderze res/i umieść w nim swój układ widoku krajobrazu. Powinno działać dobrze.

1

Ten kod działa ...

użycie tego

<?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/normal_button" 
     android:layout_height="fill_parent" 
     android:layout_gravity="center" 
     android:id="@+id/testRL"> 

     <RelativeLayout 
       android:layout_width="100dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight="true" 
       android:layout_alignParentTop="true" 
       android:background="@drawable/pressed_button" 
       android:id="@+id/testRotateLL"> 

       <TextView 
        android:id="@+id/amountLayoutTV" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_alignParentRight="true" 
        android:layout_alignParentTop="true" 

        android:text="7000TL" 
        android:textColor="@android:color/white" 
        android:textSize="15sp" /> 

     </RelativeLayout> 
</RelativeLayout> 
Powiązane problemy