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

问题描述 投票:-1回答:1

我正在测试华为MediaPad T5和三星Galaxy Tab A.他们有相同的财政规模(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: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

三星(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

android android-layout screen screen-resolution huawei
1个回答
2
投票

由制造商选择的像素密度桶。例如,在电视或平板电脑等设计用于远离脸部的东西时,它们可能会选择较低的密度,因此物品看起来更大。

因此,尽管150dp的项目在所有设备上的大小都相同,但仍会有一些变化。

© www.soinside.com 2019 - 2024. All rights reserved.