我想为不同的平板电脑设计一个应用程序,所以我创建了不同的布局文件夹,即
layout-sw600dp
layout-sw720dp
现在问题是我正在使用1280x800
& 2048x1536
个分辨率,它们都只属于layout-sw720dp
个文件夹。那么我怎样才能区分它们,以便我可以分别绘制布局。
或者我只需要获得像素密度并计算每个以及为这些标签设计的所有内容,如下所示:
dp = px / (dpi / 160)
答案 0 :(得分:1)
请参阅此DOCUMENTATION以及此link
df %>%
group_by(factor) %>%
mutate(cumbbb = cumsum((row_number() > 1) * bbb))
# A tibble: 6 x 3
# Groups: factor [2]
# bbb factor cumbbb
# <dbl> <fctr> <dbl>
#1 2.00 1 0
#2 4.00 1 4.00
#3 6.00 1 10.0
#4 3.00 2 0
#5 5.00 2 5.00
#6 7.00 2 12.0
如果布局有问题,那么为什么不尝试将SPD library用于+----------------+----------------+---------------+-------------------------------+
| Density Bucket | Screen Density | Physical Size | Pixel Size |
+----------------+----------------+---------------+-------------------------------+
| ldpi | 120 dpi | 0.5 x 0.5 in | 0.5 in * 120 dpi = 60x60 px |
+----------------+----------------+---------------+-------------------------------+
| mdpi | 160 dpi | 0.5 x 0.5 in | 0.5 in * 160 dpi = 80x80 px |
+----------------+----------------+---------------+-------------------------------+
| hdpi | 240 dpi | 0.5 x 0.5 in | 0.5 in * 240 dpi = 120x120 px |
+----------------+----------------+---------------+-------------------------------+
| xhdpi | 320 dpi | 0.5 x 0.5 in | 0.5 in * 320 dpi = 160x160 px |
+----------------+----------------+---------------+-------------------------------+
| xxhdpi | 480 dpi | 0.5 x 0.5 in | 0.5 in * 480 dpi = 240x240 px |
+----------------+----------------+---------------+-------------------------------+
| xxxhdpi | 640 dpi | 0.5 x 0.5 in | 0.5 in * 640 dpi = 320x320 px |
+----------------+----------------+---------------+-------------------------------+
margin
尺寸。
使用此功能,您可能只需为所有屏幕尺寸制作一个布局