我想知道哪个平板电脑,应用程序在运行时运行而没有屏幕计算.同样地,我们为不同平板电脑尺寸的图像资源制作了一个可绘制的文件夹(例如,7英寸的drawable-sw600dp和10英寸的drawable-sw720dp).
使用此逻辑将这些值放在各自的文件夹中,如下所示
values-sw600dp//for seven inch
<bool name="isSmallerTablet">true</bool>
values-sw720dp//for other tablets.
<bool name="isSmallerTablet">false</bool>
Run Code Online (Sandbox Code Playgroud)
并在这样的活动中使用它
if(getResources().getBoolean(R.bool.isSmallerTablet)){
}
Run Code Online (Sandbox Code Playgroud)