Genymotion虚拟机将Theme.Holo.DialogWhenLarge主题的活动显示为普通活动

5
我正在开发一个包含许多使用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>
1个回答

1
这个问题已经在Genymotion团队的2.3.0版本中得到了解决。

谢谢您提供的信息。当它发布(大约什么时候?)后,我应该更新Genymotion、模拟器镜像还是两者都要更新? - lorenzo-s
发布应该在几周内。 - eyal-lezmy
1
发布应该很快就会到来。如果您拥有付费许可证,它将在启动时建议自动更新虚拟设备。如果您使用“个人免费使用”许可证,则需要创建一个新设备来使用修复程序。 - eyal-lezmy
1
太好了。在2.3.0中看起来已经修复了!我相应地编辑了你的答案。 - lorenzo-s

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接