使用Android 2.3在HTC Touch HD2上全屏运行

时间:2012-03-16 01:54:15

标签: android opengl-es

我有一台搭载Android 2.3.4的HTC Touch HD2。我使用在Mac OS 10.5上运行的NetBeans 7.1和Android SDK 2.3。我为此操作系统下载了Google API,并创建了示例应用,但我无法全屏运行它们。我找到了一个答案,说要添加以下几行:

this.requestWindowFeature(Window.FEATURE_NO_TITLE); // (NEW)
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN); // (NEW)

但它仍然以这种方式持续运行:

enter image description here

这是在添加支持屏幕标记(不工作)后查看我的清单:

<?xml version="1.0" encoding="utf-8"?>
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.tejon"
  android:versionCode="1"
     android:versionName="1.0">
      <application android:label="@string/app_name" >
          <activity android:name="Prueba2FullScreen"
                    android:label="@string/app_name">
              <intent-filter>
                  <action android:name="android.intent.action.MAIN" />
                  <category android:name="android.intent.category.LAUNCHER" />
              </intent-filter>
            </activity>

      </application>

      <supports-screens
      android:smallScreens="true"
      android:normalScreens="true"
      android:largeScreens="true"
      android:anyDensity="true" />
  </manifest>

1 个答案:

答案 0 :(得分:0)

使用屏幕的宽度和高度设置视口。 GLES20.glViewport(0, 0, screenWidth, screenHeight);GL10.glViewport(0, 0, screenWidth, screenHeight);

编辑:以上是我最初的反应。但是,我记得去年夏天遇到了一个非常类似的问题。解决方法是向AndroidManifest.xml添加一些内容

<supports-screens
 android:smallScreens="true"
 android:normalScreens="true"
 android:largeScreens="true"
 android:anyDensity="true" />