ImageView系列:同一张图片在不同设备上显示的像素一样吗?

Posted zhangjin1120

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ImageView系列:同一张图片在不同设备上显示的像素一样吗?相关的知识,希望对你有一定的参考价值。

  • ImageView具体设置如下,同一张图片在不同设备上显示的像素一样吗?
<?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=".MainActivity">

    <ImageView
        android:id="@+id/iv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#ff0000"
        android:src="@drawable/circle"
        android:scaleType="fitXY"
        android:adjustViewBounds="true"
        />

</RelativeLayout>

vivo手机结果:
在这里插入图片描述
华为平板结果:
在这里插入图片描述
而图片本身的像素是
在这里插入图片描述
看来同一张图片在不同的设备上显示的像素是不同的
改成83dp,再试试看。

android:layout_width="83dp"
android:layout_height="83dp"

oppo手机:
在这里插入图片描述
华为平板:
在这里插入图片描述
待探究:按道理讲,不同的设备显示同一张照片,像素应该相同。为什么会出现上面的情况了?

以上是关于ImageView系列:同一张图片在不同设备上显示的像素一样吗?的主要内容,如果未能解决你的问题,请参考以下文章

如何在 iphone 的同一个视图上显示图片、视频、文本和音频?

Android UI系列-----ImageView的scaleType属性

ImageView系列:ImageView会不会自动调整高度?

如何在不同条件下在同一位置的 uitableview 单元格上使用 imageview 和 textfield

如何拍照以显示在`ImageView`中并保存图片?

Android ImageView使用详解(系列教程三)