【发布时间】:2021-07-16 14:16:14
【问题描述】:
我有一个大小为 242x314 像素的图像,但是当我把它放在 ImageView 中时,图像变成了 726x942,我在 LayoutInspector 中看到,layout_width 和 layout_height 设置为 wrap_content,这是为什么呢?我使 ImageView 的大小与图像相同。
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/eight_age" />
</android.support.constraint.ConstraintLayout>
【问题讨论】:
标签: android