layout-swdp 修飾子を使用すると、添付ファイルに示すような結果が得られます。sw 修飾子は、最小の次元が修飾子と一致するか、それよりも大きくなければならないことを意味すると想定されています。これは、Nexus 7 (4.2.1 を実行) では機能しないようです。最小幅修飾子の機能について混乱していますか、それとも N7 の報告が間違っていますか?
テスト ケースを再現するために、多くの layout-swdp フォルダーがあります。それぞれに2つのテキストフィールドがあります。1 つ目は、それがどのフォルダーにあるかを示しているだけです。次は以下のコードです。
private CharSequence collectScreenStats() {
StringBuilder str = new StringBuilder();
DisplayMetrics metrics = getResources().getDisplayMetrics();
int width = metrics.widthPixels;
int height = metrics.heightPixels;
int dpWidth = (int)(width / metrics.density);
int dpHeight = (int)(height / metrics.density);
str.append(Build.MANUFACTURER);
str.append(" ");
str.append(Build.MODEL);
str.append("\n");
str.append("Pixels: ");
str.append(width);
str.append(" x " );
str.append(height);
str.append("\nDp (px / density): ");
str.append(dpWidth);
str.append("dp x " );
str.append(dpHeight);
str.append("dp" );
str.append("\nsmallest w: " + Math.min(dpWidth, dpHeight));
str.append("\ndensity: ");
str.append(metrics.density);
str.append("\ndensityDpi: ");
str.append(metrics.densityDpi);
return str;
}