【问题标题】:Galaxy Note ResolutionGalaxy Note 分辨率
【发布时间】:2012-05-24 12:48:17
【问题描述】:

我说的是设备分辨率而不是屏幕尺寸。

我看到很多以前的问题的答案都是 320 x480,我认为这是屏幕尺寸。如果我错了,请纠正我。

例如,三星 Galaxy Note 分辨率为 1280 x 800 像素。

如何在 java 编程中获得这个值?

【问题讨论】:

    标签: android resolution galaxy


    【解决方案1】:

    试试这个

    Display display = getWindowManager().getDefaultDisplay(); 
                int width = display.getWidth();  // deprecated
                int height = display.getHeight();  // deprecated
                Log.d("hai",width+"");
                Log.d("hai",height+"");
                DisplayMetrics dm = new DisplayMetrics();
                getWindowManager().getDefaultDisplay().getMetrics(dm);
                double x = Math.pow(width/dm.xdpi,2);
                double y = Math.pow(height/dm.ydpi,2);
                double screenInches = Math.sqrt(x+y);
                Log.d("hai","Screen inches : " + screenInches+"");
    

    【讨论】:

      【解决方案2】:

      尝试this 示例了解如何获取有关设备显示的信息。

      【讨论】:

        【解决方案3】:

        800x1280px是根据http://www.phonegg.com/compare/27/Samsung-I9100-Galaxy-S-II-vs-Samsung-Galaxy-Note.html的分辨率

        这个问题应该告诉您如何获得解决方案。 Get screen dimensions in pixels

        【讨论】:

          【解决方案4】:

          使用这个简单的代码来获得分辨率。

          Display display = getWindowManager().getDefaultDisplay(); 
                  int  width = display.getWidth();
                  int height= display.getHeight();
                  TextView w=(TextView)findViewById(R.id.textView2);
                  w.setText(""+width);
                  TextView h=(TextView)findViewById(R.id.textView4);
                  h.setText(""+height);
          

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 2013-01-24
            • 2012-08-10
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多