我试图理解一些东西。我看到的一件奇怪的事情是,当我wrap_content输入宽度和高度时,图像比插入的图像的实际 px(像素)尺寸大。为什么呢?
我的代码wrap_content:
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="false"
android:src="@drawable/header" />
Run Code Online (Sandbox Code Playgroud)
这就是我的代码,具有图像的精确像素大小:
<ImageView
android:id="@+id/imageView1"
android:layout_width="378px"
android:layout_height="155px"
android:adjustViewBounds="false"
android:src="@drawable/header" />
Run Code Online (Sandbox Code Playgroud)
如您所见,这是确切的像素大小:
这是为什么?我认为wrap_content应该将视图包装到内容大小,为什么它在屏幕上更大?