1

我在上面使用了它并运行它不同的模拟器,如大、中、小。但我得到吐司正常屏幕..如何解决它

    if ((this.getResources().getConfiguration().screenLayout & 
                    Configuration.SCREENLAYOUT_SIZE_MASK) == 
                        Configuration.SCREENLAYOUT_SIZE_LARGE) {
                  Toast.makeText(this, "Large screen",Toast.LENGTH_LONG).show();
            }
            else if(((this.getResources().getConfiguration().screenLayout & 
                    Configuration.SCREENLAYOUT_SIZE_MASK) == 
                        Configuration.SCREENLAYOUT_SIZE_NORMAL)) {
                  Toast.makeText(this, "Normal screen",Toast.LENGTH_LONG).show();
            }
            else if(((this.getResources().getConfiguration().screenLayout & 
                    Configuration.SCREENLAYOUT_SIZE_MASK) == 
                        Configuration.SCREENLAYOUT_SIZE_SMALL)) {
                  Toast.makeText(this, "small screen",Toast.LENGTH_LONG).show();
            }
            else
            {
                  Toast.makeText(this, "Xlarge screen",Toast.LENGTH_LONG).show();
            }

4

1 回答 1

1
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;

阅读以下代码:- http://developer.android.com/guide/practices/screens_support.html

现在把 if 条件。

于 2013-03-01T11:21:46.167 回答