新的nexus 7 2013不接受正确的资源文件夹xhdpi

时间:2013-11-18 06:21:41

标签: android

我有旧的nexus 7 2012,现在我也有新的。但是同一个应用程序在两个设备中表现不同。因为新的nexus具有不同的分辨率,所以我不知道为什么动态imageview和动态文本表现不同。在新的关系中,图像尺寸越来越小,文字大小从11增加到18。我尝试过layout-large-xhdpi和values-large-xhdpi,但它仍然表现相同。请帮助并建议我应该做什么,所以同样的应用程序也可以在新的nexus中完美运行。

2 个答案:

答案 0 :(得分:1)

for drawables drawable-large-xhdpi

用于布局layout-large

表示值values-large

答案 1 :(得分:0)

     // Figure out what kind of display we have
          int screenLayout = getResources().getConfiguration().screenLayout;

          if ((screenLayout & Configuration.SCREENLAYOUT_SIZE_SMALL) == Configuration.SCREENLAYOUT_SIZE_SMALL)
             LogMessage("Main onCreate", "Info", "Screen size is Small");
          else if ((screenLayout & Configuration.SCREENLAYOUT_SIZE_NORMAL) == Configuration.SCREENLAYOUT_SIZE_NORMAL)
             LogMessage("Main onCreate", "Info", "Screen size is Normal");
          else if ((screenLayout & Configuration.SCREENLAYOUT_SIZE_LARGE) == Configuration.SCREENLAYOUT_SIZE_LARGE)
             LogMessage("Main onCreate", "Info", "Screen size is Large");

          if ((screenLayout & Configuration.SCREENLAYOUT_LONG_YES) == Configuration.SCREENLAYOUT_LONG_YES)
             LogMessage("Main onCreate", "Info", "Screen size is Long");

          // Get the metrics
          DisplayMetrics metrics = new DisplayMetrics();
          getWindowManager().getDefaultDisplay().getMetrics(metrics);
          int heightPixels = metrics.heightPixels;
          int widthPixels = metrics.widthPixels;
          int densityDpi = metrics.densityDpi;
          float density = metrics.density;
          float scaledDensity = metrics.scaledDensity;
          float xdpi = metrics.xdpi;
          float ydpi = metrics.ydpi;

          LogMessage("Main onCreate", "Info", "Screen W x H pixels: " + widthPixels  + " x " + heightPixels);
          LogMessage("Main onCreate", "Info", "Screen X x Y dpi: " + xdpi + " x " + ydpi);
          LogMessage("Main onCreate", "Info", "density = " + density + "  scaledDensity = " + scaledDensity +
             "  densityDpi = " + densityDpi);

***please have these lines in yours manifest***

<supports-screens
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"
 />