为什么 Android 选择了错误的密度图像?

Why is Android picking wrong density images?

我有一个 Coordinator 布局和一个 ImageView 个人资料图片,它应该来自 ActionBar "hang"。问题是 Android 从不同密度的可绘制文件夹中选择了错误的图像。布局如下所示:

你可以在这里看到图像几乎覆盖了整个屏幕(它不应该)。以下是我在各个文件夹中提供的各种可绘制尺寸:

现在,为什么 Android 显示的图像不像覆盖一小块区域(就像按照 mdpi 那样)?

(以上测试画面为xxhdpi)

注意:图像是在 Photoshop Artboard 中创建的,我们假设桌面的密度为 mdpi,其他密度的比例为 up/down手机.


参考代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/main.appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <android.support.v7.widget.Toolbar
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

            </android.support.v7.widget.Toolbar>
        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <de.hdodenhof.circleimageview.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_anchor="@id/main.appbar"
        app:layout_anchorGravity="bottom|center"
        android:src="@drawable/avatar"/>



</android.support.design.widget.CoordinatorLayout>

为什么你认为头像应该小?您的标准现代 phone 水平 dp 大约为 360-400;如果您的 mdpi 图像是 310x310(并且您的其余图像相应缩放),那么我希望图像几乎与正常图像一样宽 phone.

鉴于您发布的尺寸,一切似乎都正常工作。