2012-11-02 27 views
0

我有一個由ImageViewTextView組成的佈局。我最近將ImageView的android:src更改爲新的可繪製對象,但是當我在模擬器或設備上構建並運行應用程序時,它顯示舊圖像而不是我在XML佈局中指定的新圖像。我不明白爲什麼參考文件沒有得到更新,並且android使用圖像的舊參考。Android ImageView使用舊圖像而不是XML文件中指定的新圖像

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/list_selector" 
    android:orientation="horizontal" 
    android:padding="3dip" > 

    <ImageView 
     android:id="@+id/playImage" 
     android:layout_width="35dip" 
     android:layout_height="35dip" 
     android:src="@drawable/play_icon" /> 

    <TextView 
     android:id="@+id/playlistName" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerVertical="true" 
     android:textColor="@color/black" 
     android:maxLines="1" 
     android:layout_toRightOf="@+id/playImage" 
     android:paddingLeft="5dp" 
     android:textStyle="bold" 
     android:text="Unamed" /> 
</RelativeLayout> 

請幫幫我。

回答

0

我做了一個愚蠢的犯錯誤也是在我的自定義適配器設置ImageView的形象,這是重寫XML ImageView的默認image.I移除了適配器設置圖片src的代碼,這解決了該問題

1

在這種情況下,我刷新項目文件夾,清理項目。如果這些不起作用,那麼我會關閉並打開項目。 Eclipse多次表現怪異。

+0

我在發佈到StackOverflow之前嘗試過,但沒有工作.... – Anshul

相關問題