2

我正在开发一个仅适用于手机设备而非平板电脑的 android 应用程序。

我的应用适用于分辨率为 720x1280 且密度为 xhdpi 的 ICS 设备(例如:Galaxy S3、Galaxy Nexus、Xperia V 等)

如果我使用 layout-sw360dp 如何防止/阻止 Nexus7 平板电脑加载我的应用程序屏幕?

或者如何限制应用程序只能在 720x1280 分辨率的手机设备上运行?

4

1 回答 1

2

首先获取设备的宽度和高度,您可以轻松控制它。

  Display display = getWindowManager().getDefaultDisplay(); 
            int width = display.getWidth();
            int height = display.getHeight();

            System.out.println(width+" "+height);

            if(height>720 && width>1280)
            {
                mainActivityrun();
            }
          else
          {
               finish();
           }
于 2013-01-01T05:57:35.867 回答