2016-12-27 40 views
-2

我知道还有其他两个帖子,比如这个,听我说我尝试了他们的代码,以及我无法让我的应用程序锁定到横向模式。如何将应用程序锁定到横向

我已经在Java清单中放置了屏幕方向,但仍然没有任何东西。这是代码。

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.anthonypalmer.tappydefender"> 
<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 
    <activity android:name=".MainActivity"> 
     android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
     android:screenOrientation="landscape" 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <!-- 
    ATTENTION: This was auto-generated to add Google Play services to your project for 
    App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. 
    --> 
    <meta-data 
     android:name="com.google.android.gms.version" 
     android:value="@integer/google_play_services_version" /> 
+1

你缺少>的android后:screenOrientation = “风景” – Isaac

+0

OK谢谢艾萨克 –

回答

1

你把你的attibutes放在错误的地方。 android:themeandroid:screenOrientation是“的Neighbors'of android:name<activity> -section:

<activity 
     android:name=".MainActivity" 
     android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
     android:screenOrientation="landscape"> 
+0

OK谢谢你这个网站是一个很大的帮助我的项目 –

相关问题