2016-02-12 93 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的大小以確保其正確加載。

從大型照片的經驗,他們通常不容易在模擬器上加載。所以請嘗試將較小的圖像作爲最後一步。