lor*_*o-s 5 android android-theme genymotion
我正在开发一个Android平板电脑应用程序,其中包含许多使用该Theme.Holo.DialogWhenLarge主题的活动.在真实设备(Nexus 7 KitKat和三星Galaxy Tab 3 8")上,这些活动按预期显示,但在我尝试创建的每个Genymotion VM(例如Nexus 7 KitKat和Nexus 10 Jelly Bean)上,它们显示为正常完整 -屏幕活动.我还在使用标准Android SDK虚拟设备管理器创建的Nexus 7 KitKat仿真器上进行了测试,并按预期显示了活动.
我可以忽略它并假设它只是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);
    }
}
RES /布局/ 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>
| 归档时间: | 
 | 
| 查看次数: | 521 次 | 
| 最近记录: |