2012-08-26 2 views
1

내가 시작하려고하는이 시작 앱에 대해 java로 정상입니다. 그러나 XML은 여전히 ​​내 마음을 조금이라도 바꿀 수 있습니다. 달성하고자하는 것의 그림을 포함 시켰습니다. enter image description hereAndroid 레이아웃 도움말 - 화면 절반을 뒤집어 야합니다.

그리고 지금까지 제가 가지고있는 코드가 있습니다. 나는 그것이 나온 방법에 만족합니다. 나는 그 전반을 뒤집을 수있는 방법을 알아야합니다.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

    <LinearLayout 
     android:id="@+id/opponent" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:gravity="bottom" 
     android:layout_weight="1" 
     android:clickable="false" > 

     <RelativeLayout 
      android:id="@+id/opPlus" 
      android:layout_width="wrap_content" 
      android:layout_height="50dp" 
      android:layout_weight="0.5" 
      android:clickable="true" > 

     </RelativeLayout> 

     <RelativeLayout 
      android:id="@+id/opMinus" 
      android:layout_width="wrap_content" 
      android:layout_height="50dp" 
      android:layout_weight="0.5" 
      android:clickable="true" > 

     </RelativeLayout> 

    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/player" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:gravity="bottom" 
     android:layout_weight="1" 
     android:clickable="false" > 

     <RelativeLayout 
      android:id="@+id/plPlus" 
      android:layout_width="wrap_content" 
      android:layout_height="50dp" 
      android:layout_weight="0.5" 
      android:clickable="true" > 

     </RelativeLayout> 

     <RelativeLayout 
      android:id="@+id/plMinus" 
      android:layout_width="wrap_content" 
      android:layout_height="50dp" 
      android:layout_weight="0.5" 
      android:clickable="true" > 

     </RelativeLayout> 

    </LinearLayout> 

미리 감사드립니다!

답변

2

은 간단히 추가

android:rotation="180" 

당신이 회전 할 뷰 또는 뷰 그룹에. 이 경우, @+id/opponent

편집의 ID와 LinearLayout : 예 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    > 
    <RelativeLayout 
    android:id="@+id/opponent" 
    android:rotation="180" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" 
    android:background="#FF8833" 
    > 
    <View 
     android:id="@+id/emptyview" 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_centerInParent="true" 
     /> 
    <Button 
     android:layout_height="50dp" 
     android:layout_width="match_parent" 
     android:layout_toLeftOf="@id/emptyview" 
     android:layout_alignParentBottom="true" 
     android:background="#999999" 
     android:text="Button 1" 
     /> 
    <Button 
     android:layout_height="50dp" 
     android:layout_width="match_parent" 
     android:layout_toRightOf="@id/emptyview" 
     android:layout_alignParentBottom="true" 
     android:background="#888888" 
     android:text="Button 2" 
     /> 
    </RelativeLayout> 
    <RelativeLayout 
     android:id="@+id/opponent" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:background="#33FF33" 
     > 
    <View 
     android:id="@+id/emptyview" 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_centerInParent="true" 
     /> 
    <Button 
     android:layout_height="50dp" 
     android:layout_width="match_parent" 
     android:layout_toLeftOf="@id/emptyview" 
     android:layout_alignParentBottom="true" 
     android:background="#999999" 
     android:text="Button 1" 
     /> 
    <Button 
     android:layout_height="50dp" 
     android:layout_width="match_parent" 
     android:layout_toRightOf="@id/emptyview" 
     android:layout_alignParentBottom="true" 
     android:background="#888888" 
     android:text="Button 2" 
     /> 
    </RelativeLayout> 
</LinearLayout> 

결과 :

enter image description here

+0

나는 이유를 모르겠지만 난에 넣을 때 그래픽 인터페이스를 다시로드하면 변경 사항이 표시되지 않습니다. 2 개의 버튼은 화면 중앙에 여전히 있습니다. – Psest328

+1

저에게 맞습니다. 나는 내가 한 일의 예를 편집했다. – kcoppock

+0

알겠습니다. 기묘한. 내가 받고있어 : 오류. 패키지 "android"의 속성 "rotation"에 대한 리소스가 없습니다. – Psest328

관련 문제