为什么具有相同物理尺寸和分辨率的设备可能具有不同的密度?

时间:2019-03-31 16:45:26

标签: android android-layout screen screen-resolution huawei

我正在测试华为MediaPad T5和三星Galaxy TabA。 它们具有相同的财务尺寸(10.1英寸)和像素数(1920 * 1200),

问题1:为什么它们具有不同的密度(2.0和1.5)?密度仅取决于财政规模和像素数量,对吗?

问题2:我使用dp为边栏(150dp)设置了相同的宽度,为什么它们看起来不同?

    <android.support.v7.widget.RecyclerView
        android:id="@+id/fcom_categories"
        android:layout_width="150dp"
        android:layout_height="match_parent"
        android:background="@color/white"
        android:scrollbars="none"
        app:layoutManager="android.support.v7.widget.LinearLayoutManager"/>

华为: huawei

三星: samsung

PS:我在此处打印了显示规格

华为(xhdpi)

2019-03-31 17:37:23.801 15550-15550/com.ristoo I/DisplaySpecifications: displayName  = 内置屏幕
2019-03-31 17:38:05.072 15550-15550/com.ristoo I/DisplaySpecifications: width        = 1920
2019-03-31 17:38:05.072 15550-15550/com.ristoo I/DisplaySpecifications: height       = 1133
2019-03-31 17:38:05.073 15550-15550/com.ristoo I/DisplaySpecifications: widthPixels  = 1920
2019-03-31 17:38:05.073 15550-15550/com.ristoo I/DisplaySpecifications: heightPixels = 1133

2019-03-31 18:13:03.031 16436-16436/com.ristoo I/DisplaySpecifications: density   = 2.0
2019-03-31 17:38:05.073 15550-15550/com.ristoo I/DisplaySpecifications: densityDpi   = 320

2019-03-31 17:38:05.073 15550-15550/com.ristoo I/DisplaySpecifications: xdpi         = 225.777
2019-03-31 17:38:05.073 15550-15550/com.ristoo I/DisplaySpecifications: ydpi         = 225.777
2019-03-31 17:38:05.074 15550-15550/com.ristoo I/DisplaySpecifications: screenHeight = 1133
2019-03-31 17:38:05.074 15550-15550/com.ristoo I/DisplaySpecifications: screenWidth  = 1920
2019-03-31 17:38:05.074 15550-15550/com.ristoo I/DisplaySpecifications: orientation  = 2

Sumsung(hdpi)

2019-03-31 17:40:57.310 24205-24205/com.ristoo I/DisplaySpecifications: displayName  = 内置屏幕
2019-03-31 17:40:57.311 24205-24205/com.ristoo I/DisplaySpecifications: width        = 1920
2019-03-31 17:40:57.311 24205-24205/com.ristoo I/DisplaySpecifications: height       = 1200
2019-03-31 17:40:57.312 24205-24205/com.ristoo I/DisplaySpecifications: widthPixels  = 1920
2019-03-31 17:40:57.312 24205-24205/com.ristoo I/DisplaySpecifications: heightPixels = 1200

2019-03-31 18:12:15.386 25654-25654/com.ristoo I/DisplaySpecifications: density   = 1.5
2019-03-31 17:40:57.312 24205-24205/com.ristoo I/DisplaySpecifications: densityDpi   = 240

2019-03-31 17:40:57.313 24205-24205/com.ristoo I/DisplaySpecifications: xdpi         = 225.777
2019-03-31 17:40:57.313 24205-24205/com.ristoo I/DisplaySpecifications: ydpi         = 225.77701
2019-03-31 17:40:57.314 24205-24205/com.ristoo I/DisplaySpecifications: screenHeight = 1200
2019-03-31 17:40:57.314 24205-24205/com.ristoo I/DisplaySpecifications: screenWidth  = 1920
2019-03-31 17:40:57.314 24205-24205/com.ristoo I/DisplaySpecifications: orientation  = 2

1 个答案:

答案 0 :(得分:2)

由制造商决定选择哪个像素密度存储桶。例如,在电视或平板电脑等设计用于距离您的脸更远的地方,它们可能会选择较低的密度,因此物品看起来更大。

因此,尽管150dp的商品在所有设备上的尺寸都大致相同,但仍然会有一些变化。