Q:

Why devices that have same physical size and resolution may have different density?

I am testing on Huawei MediaPad T5 and Samsung Galaxy Tab A.
They have the same  fiscal size (10.1 inch) and pixel number (1920*1200),
Question 1: Why they have different density (2.0 and 1.5)?  Density dipendes only on fiscal size and pixel number, right?
Question 2: I gave the same width to the sidebar (150dp) using dp, why they look different?
    <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: I printed there display specifications
Huawei  （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

A:

It is up to the manufacturer which pixel density bucket to choose. For example on something like a tv or tablet which is designed to be used further away from your face they might pick a lower density so items looks larger.
So although an item which is 150dp will be ROUGHLY the same size on all devices, there will still be some variation. 

