2011-07-04 3 views
2

Here으로 보았지만 여전히 문제를 해결할 수 없습니다.Android 앱이 항상 가로 모드로 유지됩니다.

나는 최근에 안드로이드 (headfirst)로 뛰어 들었고 주변을 어지럽 혔다. 화면이 기울어 진 방식에 관계없이 내 응용 프로그램을 가로 모드로만 실행하고 싶습니다.

내 홈 화면은 기본적으로 배경과 몇 개의 버튼이 오른쪽에 정렬 된 페이지입니다.

은 여기 내 XML

당신은 당신의 AndroidManifest.xml 파일에서 활동 태그에 android:screenOrientation="landscape"을 둘 필요가
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:paddingLeft = "450px" 
    android:paddingRight = "60px" 
    android:paddingTop="25px" 
//I have tried adding orientation commands here like the one below?? 
    android:screenOrientation="landscape" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background = "@drawable/sign" 
    > 

<Button 
android:id="@+id/Button1" 
android.layout_height="60px" 
android.layout_width="30px" 
android:layout_height="wrap_content" 
android:layout_width="fill_parent" 
android:text="Button1"/> 

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

<Button 
android:id="@+id/Button2" 
android.layout_height="60px" 
android.layout_width="30px" 
android:layout_height="wrap_content" 
android:layout_width="fill_parent" 
android:text="Button2"/> 
+0

bahh 나는 잘못된 파일을 변경하고있었습니다. 내가 연결된 다른 질문은 내가 시도한 무언가가 문제가 – sealz

답변

7

추가하여 manifest.xml 파일에이 라인.

<activity android:name=".activity" android:screenOrientation="portrait"></activity> 

당신은 가로 방향은 다음 대신 세로의 풍경을 변경하려는 경우

How to set android show vertical orientation?

+0

이 줄 어디서 오류가 발생하는지, 그렇지 않은 경우로드가 충돌하는 것 같습니다. – sealz

3

이 매니페스트 파일에서 다음 특성을 모두하는 행동이 추가 참조 :

안드로이드 : screenOrientation = "landscape"

예 :

<activity android:name=".MainActivity" android:screenOrientation="landscape" " > 
       <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

당신은 매니페스트 파일에 또한 응용 프로그램 태그에이 속성을 추가 할 수 있습니다.

희망 사항은이 문제를 해결하는 데 도움이 되길 바랍니다.

관련 문제