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我已经编辑了这篇文章。谢谢