如何找到运行在7英寸或10英寸选项卡上的android应用程序?
我需要找到我的应用程序运行在7英寸标签或10英寸标签。我如何才能找到它。请任何人可以帮助我 提前感谢。试试这个如何找到运行在7英寸或10英寸选项卡上的android应用程序?,android,android-layout,Android,Android Layout,我需要找到我的应用程序运行在7英寸标签或10英寸标签。我如何才能找到它。请任何人可以帮助我 提前感谢。试试这个 Display deviceDisplay = getWindowManager().getDefaultDisplay(); int width = deviceDisplay.getWidth(); int height = deviceDisplay.getHeight(); DisplayMetrics dm = new DisplayMetrics(); getWindo
Display deviceDisplay = getWindowManager().getDefaultDisplay();
int width = deviceDisplay.getWidth();
int height = deviceDisplay.getHeight();
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
double xPoints = Math.pow(dm.widthPixels/dm.xdpi,2);
double yPoints = Math.pow(dm.heightPixels/dm.ydpi,2);
double deviceScreenSizeInInch = Math.sqrt(xPoints+yPoints);
在值-sw600和sw 720中创建布尔值,如下所示 在sw600中 这是正确的; Istenich-假 在sw720中 Istenich-正确; 一英寸-假 在运行时得到bool值,你就可以找到你需要的
From您的意思是应用程序在多大屏幕上运行?我如何检查它在7英寸还是10英寸选项卡上运行?检查设备的更新ans jst nw checeked(在模拟器中)值CreensizeInch=7.270660324187946(对于7英寸),对于10英寸,它将相应地获得gve值,而不是接近的精确10 bt值。int cast和所有可能需要的。。。希望这会有所帮助