我正在开发一个包含许多使用
我可以忽略这个问题,假设它只是Genymotion模拟器的问题,但我想知道是否有一种方法来解决这个问题,以便拥有更好的测试环境。我想指出的是,
为了减少问题的所有可能原因,我创建了一个新的测试项目,其中包含一个具有按钮的普通主活动,该按钮启动一个DialogWhenLarge-themed活动。我还删除了Eclipse自动创建的所有Android支持库和所有XML样式文件:剩下的唯一资源是两个活动的布局和启动器图标。这些是测试项目的所有文件: src/com/example/testdialogwhenlarge/MainActivity.java
Theme.Holo.DialogWhenLarge
主题的活动的Android平板应用程序。在真实设备上(如Nexus 7 KitKat和Samsung Galaxy Tab 3 8英寸),这些活动会按预期显示,但是在我尝试创建的每个Genymotion虚拟机(例如Nexus 7 KitKat和Nexus 10 Jelly Bean)上,它们都会被显示为正常的全屏活动。我还测试了使用标准Android SDK虚拟设备管理器创建的Nexus 7 KitKat模拟器,并且活动被按预期显示。我可以忽略这个问题,假设它只是Genymotion模拟器的问题,但我想知道是否有一种方法来解决这个问题,以便拥有更好的测试环境。我想指出的是,
*-large
资源限定符在Genymotion VM上起作用,该问题似乎仅与该主题相关。为了减少问题的所有可能原因,我创建了一个新的测试项目,其中包含一个具有按钮的普通主活动,该按钮启动一个DialogWhenLarge-themed活动。我还删除了Eclipse自动创建的所有Android支持库和所有XML样式文件:剩下的唯一资源是两个活动的布局和启动器图标。这些是测试项目的所有文件: src/com/example/testdialogwhenlarge/MainActivity.java
package com.example.testdialogwhenlarge;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends Activity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
// Start the DialogWhenLarge-themed activity
startActivity(new Intent(MainActivity.this, TestActivity.class));
}
});
}
}
src/com/example/testdialogwhenlarge/TestActivity.java
package com.example.testdialogwhenlarge;
import android.app.Activity;
import android.os.Bundle;
public class TestActivity extends Activity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
}
}
res/layout/activity_main.xml
<FrameLayout
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="com.example.testdialogwhenlarge.MainActivity">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</FrameLayout>
res/layout/activity_test.xml
<FrameLayout
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="com.example.testdialogwhenlarge.TestActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</FrameLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testdialogwhenlarge"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="TestDialogWhenLarge"
android:theme="@android:style/Theme.Holo">
<activity android:name="com.example.testdialogwhenlarge.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.testdialogwhenlarge.TestActivity"
android:theme="@android:style/Theme.Holo.DialogWhenLarge">
</activity>
</application>
</manifest>