2014-07-15 36 views
5

我正在開發一個Android平板電腦應用程序,其中包含許多使用Theme.Holo.DialogWhenLarge主題的活動。在真實設備上(Nexus 7 KitKat和三星Galaxy Tab 3 8「),這些活動按預期顯示,但在我嘗試創建的每個Genymotion虛擬機上都會顯示(例如,Nexus 7 KitKat和Nexus 10 Jelly Bean)全屏幕的活動,我也在Nexus 7 KitKat仿真器上測試過,並使用標準的Android SDK虛擬設備管理器創建,並且按照預期顯示活動Genymotion虛擬機顯示Theme.Holo.DialogWhenLarge主題活動作爲正常的

我可以忽略它,並且假設它只是Genymotion仿真器的一個問題,但我想知道是否有辦法解決這個問題,以便擁有更好的測試環境。我想指出*-large資源限定符適用於Genymotion虛擬機,這個問題看起來只與這個主題有關。

爲了減少問題的所有可能原因,我創建了一個新的測試項目,其中包含一個啓動DialogWhenLarge主題活動的按鈕。我還刪除了Eclipse自動創建的所有Android支持庫和所有XML樣式文件:剩下的唯一資源是活動和啓動器圖標的兩個佈局。這些測試項目中的所有文件:

的src/COM /例子/ 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 /例子/ 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); 
    } 

} 

[R ES /佈局/ 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 /佈局/ 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

此問題已由Genymotion團隊在發行版2.3.0中修復。

+0

謝謝你的信息。當發佈(約?)時,我應該更新Genymotion,模擬器圖像或兩者? –

+0

該版本應在幾周內發佈。 –

+1

該版本即將推出。如果您有付費許可證,它會建議在啓動時自動更新虛擬設備。如果您使用「免費個人使用」許可證,則需要創建一個新設備才能使用該修補程序。 –