有些设备采用不同的方向(暂时),然后我在Manifest中设置

时间:2017-09-26 12:51:22

标签: android android-manifest tablet screen-orientation

  

我检查了所有堆栈溢出中的每个可能的解决方案   解决方案和其他网站也没有运气。

     

我的要求是:

     

手机 - 仅限人像模式

     

平板电脑 - 纵向和横向模式。

尝试使用以下内容:

如果是我使用过的手机或平板电脑,请查找设备

if (getResources().getBoolean(R.bool.is_sw_600dp_size)) {

    intent = new Intent(LauncherEmptyActivity.this, SplashActivityTablet.class);

} else {

    intent = new Intent(LauncherEmptyActivity.this, SplashActivity.class);
}

对于我的要求,如果我为所有活动设置方向如下 (所有方向都设置在Manifest,也尝试通过编程但没有运气)

  1. LauncherEmptyActivity - 设置传感器

                        (or Set any of these above -  "nosenser", "userSensor", "unspecified", "fullUser", "user")
    
  2. SplashActivity - 设置肖像

  3. SplashActivityTabet - 与LauncherEmptyActivity相同

  4. 结果:

    • 应用程序在平板电脑中以纵向和横向模式打开(预期O / P

    • 但对于手机如果它以横向模式保持,那么 - SplashActivity将在短暂的时刻呈现景观 那就是肖像 (这是问题,我暂时不想这样做。)

    问题发生在

    • 设备 - Nexus 5x(Naught),

    • 模拟器 - Google Pixel(奥利奥)

    但在Device - Moto G4 Plus(Naught)中工作正常

      

    这是为了更多解释目的,完全按照解决方案   如果我的要求是

         

    (适用于所有上述设备)

         

    手机 - 仅限人像

         

    平板电脑 - 仅景观

    1. LauncherEmptyActivity - 设置肖像

    2. SplashActivity - 设置肖像

    3. SplashActivityTablet - 设置格局

    4. (在Manifest设置的所有方向)

      结果:按预期正确

0 个答案:

没有答案