我曾经在其他地方看到过这种情况的图片,但是那是一段时间以前了,一般的答案是“这是Android 2.3中已知的问题”。我正在使用4.4,所以肯定不是这个答案。
我有一个非常简单的程序:“Hello, Android”。当我启动模拟器时,它会以纵向模式加载。使用Fn-Ctrl-F11(Mac),模拟器会旋转到横向模式。但是应用程序和手机控件并没有重绘——整个界面只是侧着。这里是清单:
我正在使用Eclipse构建ADT bundle build v22.3.0-887826,虽然我认为这对于这种小事并不重要。我的模拟器是针对Galaxy Nexus设备的,Android 4.4 API级别为19。我已经尝试过将硬件键盘设置为存在和不存在。我发现了一个“键盖支持”设置的参考,但我还没有在任何地方看到过 - 这个评论是来自3/12,所以可能已经过时了。这是我的第一个Android应用程序,因此我完全是在这个环境中进行调试的新手。谢谢您提供任何有关我错过了什么的建议。
编辑:添加hello.java代码。
我有一个非常简单的程序:“Hello, Android”。当我启动模拟器时,它会以纵向模式加载。使用Fn-Ctrl-F11(Mac),模拟器会旋转到横向模式。但是应用程序和手机控件并没有重绘——整个界面只是侧着。这里是清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.helloandroid"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.test.helloandroid.Hello"
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>
</manifest>
以及Activity的XML文件:
<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"
tools:context=".Hello" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</LinearLayout>
我正在使用Eclipse构建ADT bundle build v22.3.0-887826,虽然我认为这对于这种小事并不重要。我的模拟器是针对Galaxy Nexus设备的,Android 4.4 API级别为19。我已经尝试过将硬件键盘设置为存在和不存在。我发现了一个“键盖支持”设置的参考,但我还没有在任何地方看到过 - 这个评论是来自3/12,所以可能已经过时了。这是我的第一个Android应用程序,因此我完全是在这个环境中进行调试的新手。谢谢您提供任何有关我错过了什么的建议。
编辑:添加hello.java代码。
package com.test.helloandroid;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class Hello extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hello);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.hello, menu);
return true;
}
}
Hello.java
的邮政编码是多少? - Mehul Joisar