Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 为什么图像没有';不显示在ImageView中_Android_Image_Imageview - Fatal编程技术网

Android 为什么图像没有';不显示在ImageView中

Android 为什么图像没有';不显示在ImageView中,android,image,imageview,Android,Image,Imageview,我有一个图像(w=640px,h=1136)。当我将其设置为ImageView时,宽度和高度为full\u parent。图像没有出现,为什么 编辑 xml代码: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"

我有一个图像
(w=640px,h=1136)
。当我将其设置为
ImageView
时,宽度和高度为
full\u parent
。图像没有出现,为什么

编辑 xml代码:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <ImageView
        android:id="@+id/ivSplash"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:contentDescription="spalsh screen"
        android:scaleType="fitXY"
        android:src="@drawable/splash" />

</FrameLayout>


从您发布的代码中,我发现您有一个错误
完整的父项
正确的值是
填充父项
,但此值已被弃用。您应该使用
匹配父项
我已经尝试了您描述的配置,并且似乎对我有效。下面是我自己的XML:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainScreenActivity" >


    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/imageView" 
        android:src="@drawable/splash"/>
</FrameLayout>

我最初的想法是,也许你拼错了
fill\u parent
,这就是它不起作用的原因。在任何情况下,您都应该使用
match_parent
()


我发现NickF比我先找到了答案:)

你能发布你的xml吗?@Dev iL我已经编辑了这篇文章。谢谢