2016-02-12 91 views
2

我的图片显示在Android Studio本身上,但是当上传到我的手机时,图像消失了。也许这是一个太大的形象? 这是1900 x 1250像素。Imageview没有显示我的图像?

我不知道我在做什么错..

enter image description here

<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="About" 
    android:id="@+id/button" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:backgroundTint="#fed136" /> 

<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Portfolio" 
    android:id="@+id/button3" 
    android:backgroundTint="#fed136" 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" /> 

<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Contact" 
    android:id="@+id/button4" 
    android:layout_alignBottom="@+id/button3" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentEnd="true" 
    android:backgroundTint="#fed136" /> 

<ImageView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:id="@+id/imageView" 
    android:layout_below="@+id/button3" 
    android:scaleType="fitXY" 
    android:src="@drawable/header" /> 

+0

将您的布局作为代码发布,以便每个人都可以编辑并帮助解决您的问题。图像中的代码不够清晰。 –

+0

是的,图像可能太大。将图像保存在drawable-xxxhdpi文件夹中,看看它是否出现在手机中。 –

+0

但多数民众赞成的问题,我的drawable-xxxhdpi文件夹在哪里? – Lucafraser

回答

1

是的,布局看起来不错。尝试将图像放置在drawable-xxxhdpi文件夹中。在res文件夹中创建一个文件夹,并将其命名为drawable-xxhdpi(如果它不存在)。将大图像放在这个文件夹中,并检查是否有帮助。

如果不是,请调整图片大小,因为这是您在此处猜测的唯一问题。图像太大会导致低端设备出现内存不足错误。

1

我不能把一个评论,但尝试去寻找图像视图在您的活动。这可能是因为你的代码从那里覆盖它。

也会限制您的imageview从布局xml的大小以确保其正确加载。

从大型照片的经验,他们通常不容易在模拟器上加载。所以请尝试将较小的图像作为最后一步。