android - Genymotion 虚拟机将 Theme.Holo.DialogWhenLarge 主题 Activity 显示为正常 Activity

标签 android android-theme genymotion

我正在开发一个 Android 平板电脑应用程序,其中包含许多使用 Theme.Holo.DialogWhenLarge 主题的 Activity 。在真实设备(Nexus 7 KitKat 和 Samsung Galaxy Tab 3 8")上,这些 Activity 按预期显示,但在我尝试创建的每个 Genymotion VM 上(例如 Nexus 7 KitKat 和 Nexus 10 Jelly Bean)它们显示为正常的全屏 Activity 。我还在使用标准 Android SDK 虚拟设备管理器创建的 Nexus 7 KitKat 模拟器上进行了测试,并且 Activity 按预期显示。

我可以忽略它并假设它只是 Genymotion 模拟器的问题,但我想知道是否有办法修复它以获得更好的测试环境。我想指出 *-large 资源限定符适用于 Genymotion VM,该问题看起来仅与该主题相关。

为了减少问题的所有可能原因,我创建了一个新的测试项目,其中包含一个正常的主要 Activity ,该 Activity 有一个启动 DialogWhenLarge 主题 Activity 的按钮。我还删除了所有 Android 支持库和 Eclipse 自动创建的所有 XML 样式文件:唯一剩下的资源是 Activity 的两个布局和启动器图标。这些是测试项目的所有文件:

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>

最佳答案

Genymotion 团队在 2.3.0 版中修复了这个问题。

关于android - Genymotion 虚拟机将 Theme.Holo.DialogWhenLarge 主题 Activity 显示为正常 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24752664/

相关文章:

android - 是否可以在 Android 应用程序中注入(inject)代码?

android - 为什么我的移动应用安装量没有显示在我的 Facebook 广告 Activity 下?

android - 如何为 Activity 应用浅色主题并同时为对话框保留深色主题?

android - 如何根据应用程序的整体主题更改 `app:popupTheme`?

login - Genymotion凭证。我无法登录 Sprite 运动凭证

android - 使用 genymotion 显示表情符号面板 - 键盘/触摸输入?

android - AlertDialog 按钮未包装在 Lollipop 中

android - Webview 膨胀时不加载

android - 一个 Activity 两个不同的 Layouts 有自己的主题?

android - 更新 SDK 后 Cordova 模拟不在 Genymotion 上运行