Android studio 如何为任何屏幕选择理想的图像大小?

Android studio 如何为任何屏幕选择理想的图像大小?,android-studio,imageview,android-imageview,image-size,Android Studio,Imageview,Android Imageview,Image Size,我试图将图像插入屏幕,但当我插入一些大图像时,会出现“太大位图像”的错误,当我插入一个小图像(如400 x 400像素)时,图像会变得模糊。 如何选择准确的图像大小,使其看起来良好(不模糊) 这是代码 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android&qu

我试图将图像插入屏幕,但当我插入一些大图像时,会出现“太大位图像”的错误,当我插入一个小图像(如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>

对于每个dpi,您可以使用矢量图像,也可以使用不同大小的光栅图像


如果可以的话,我建议您选择vector,因为它更简单、更轻,但如果您不能使用vector图像,它将指导您。

显示您的代码,以获得更好的帮助嗨,谢谢您的回复。我正在运行“Nexus9”中的代码。我已经创建了一个imageView,希望在其中放置一个图像。当我将比例类型设置为“中心裁剪”时,它会变得模糊。当我使用任何其他属性(如“Center/Centerfit”)时,它不会覆盖整个屏幕。因此,如果我想覆盖整个屏幕,可以指导我如何正确选择图像大小图像的大小(高度和宽度)。