我试图添加3图像视图与文本,但我有问题的图像。
在图像的下面和上面有一些很大的空间,所以图像就像一个正方形。而且我在更改其他图像和文本时遇到了问题。它就像是图像周围的一层。
如下所示:

这是我的代码。
<androidx.constraintlayout.widget.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/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/tuna" />发布于 2019-11-28 08:32:43
将adjustViewBounds设置为true并调整缩放类型。
发布于 2019-11-28 08:28:35
这是由于您的图像文件造成的。它由透明像素组成。
如果您要手动添加图像,则可以使用photoshop删除这些图像。或者,如果您是从服务器获取该镜像,您可以尝试通过下面的答案通过代码将其删除。remove transparent pixels from bitmap
发布于 2019-11-28 08:29:40
尝试使用照片编辑器调整图像文件的宽度和高度(例如Adobe photoshop)
https://stackoverflow.com/questions/59079768
复制相似问题