本文介绍了我的应用程序的多屏支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑我是否要处理我的设备,这我目前正在测试我的应用程序上,作为一个中型或大型设备的密度。该设备是根据三星提供的设备规格的三星Galaxy S3的迷你与480 * 800像素,4.0英寸显示屏。

I am quite confused whether I have to deal with my device, which I'm currently testing my app on, as a medium or large density device. The device is Samsung Galaxy S3 mini with 480 x 800 pixels, 4.0 inches display according to the device specifications provided by Samsung.

我计划优化我的绘图资源,使得各种屏幕尺寸和像素密度都支持。由于S3 mini是我的测试装置,它发射的图标实际上是它使用的呢?它是根据绘-LDPI,绘制,MDPI,绘制,HDPI或绘,xhdpi的人?

I am planning to optimize my drawables such that a wide range of screen sizes and densities are supported. Since S3 mini is my testing device, which launcher icon is actually the one used in it? is it the one under drawable-ldpi, drawable-mdpi, drawable-hdpi or drawable-xhdpi?

推荐答案

试试这个办法,希望这将帮助你解决你的问题。

switch (getResources().getDisplayMetrics().densityDpi) {
    case DisplayMetrics.DENSITY_LOW:
         // write your code here.
         break;
    case DisplayMetrics.DENSITY_MEDIUM:
         // write your code here.
         break;
    case DisplayMetrics.DENSITY_HIGH:
         // write your code here.
         break;
    case DisplayMetrics.DENSITY_XHIGH:
         // write your code here.
         break;
    case DisplayMetrics.DENSITY_XXHIGH:
         // write your code here.
         break;
    case DisplayMetrics.DENSITY_TV:
         // write your code here.
         break;
 }

这篇关于我的应用程序的多屏支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 21:03