定向没有工作2.3.3?工作

2023-09-06 13:15:00 作者:星星跌入梦境

我有prepared 1 application.My应用将会同时支持横向和纵向。  当我改变方向,从纵向到横向它工作正常,但是当我改变横向到纵向它不是working.my code是,

I have prepared one application.My application will be supports both landscape and portrait. When i change the orientation from portrait to landscape it is working fine,But when i change landscape to portrait it is not working.my code is,

  public void onConfigurationChanged(Configuration newConfig) {

        super.onConfigurationChanged(newConfig);
        System.out.println("orientation---"+getResources().getConfiguration().orientation);
        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
            setContentView(R.layout.main);
            System.out.println("landscape-----");
        } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
            setContentView(R.layout.main);
            System.out.println("portrait-----");
        }

    }

每当一次只服用景观mode.I出错了一些地方。请大家帮忙。

Every time time it taking only landscape mode.I made mistake some where. please help.

System.out.println("orientation---"+getResources().getConfiguration().orientation);

以上SOP是打印2手段landscape.Please帮助我。(我使用2.3.3)

The above SOP is printing 2 means landscape.Please help me.(i am using 2.3.3)

推荐答案

您可能会达不到这个错误的方向并从横向到纵向的模拟器上2.3没有改变

You might be hitting this bug "Orientation does not change from landscape to portrait on Emulator on 2.3"

45个以上的人都面临着同样的问题,与androidd 2.3模拟器

More than 45 people are facing the same issue with the androidd 2.3 emulator

HTTP://$c$c.google。 COM / P /安卓/问题/详细信息?ID = 13189

主机操作系统:Windows 7 SDK工具版本:版本8 Eclipse版本:3.5   ADT插件版本:8.0.1平台,你的项目目标:2.3   该平台的版本在模拟器中运行:2.3

Host OS: Windows 7 SDK tools version : revision 8 Eclipse version: 3.5 ADT plug-in version: 8.0.1 Platform targeted by your project: 2.3 Version of the platform running in the emulator:2.3

重现步骤:   1.活动1(无屏幕方向) - 活动2(屏幕方向=横向)

STEPS TO REPRODUCE: 1. Activity 1 (no screen orientation) - Activity 2 (screen orientation = landscape)

  从活动1至2个工作正常走向。 pressing回改变活动1到横向的方向   

预期结果:活动1应该是在肖像模式

EXPECTED RESULTS: Activity 1 should be in portrait mode

观察到的结果:行为是仅见于姜饼,工作原理   预期升级Froyo。

OBSERVED RESULTS: Behavior is observed only in gingerbread, works as expected on froyo.