【发布时间】:2021-05-01 21:00:35
【问题描述】:
我正在尝试将图像插入屏幕,但是当我插入一些大图像时,它会出现“位图太大”的错误,而当我插入像 400 x 400 像素这样的小图像时,它会变得模糊。 如何选择准确的图像尺寸,使其看起来不错(不模糊)。
这里是代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".MainActivity2">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/non"
android:scaleType="centerCrop">
</ImageView>
【问题讨论】:
-
显示您的代码,以获得更好的帮助
-
您好,感谢您的回复。我在“Nexus 9”中运行代码。我创建了一个 imageView 并想在其中放置一个图像。当我将比例类型设置为“Centercrop”时,它会变得模糊。当我使用像“Center/Centerfit”这样的任何其他属性时,它不会覆盖整个屏幕。如果我想覆盖整个屏幕,那么可以指导我如何正确选择图像尺寸(高度和宽度)。
标签: android-studio imageview android-imageview image-size