我有一個ImageView對象,我設置android:src =「@ drawable/some_xml_file」而不是標準的png,它似乎並不總是呈現drawable,正如你可以看到的在這裏的第一行(它也會間歇性地發生在其他行中):alt text http://www.freeimagehosting.net/uploads/d09b549a9d.jpgAndroid ImageView與繪製不總是呈現
我試過設置src &的背景屬性,但它們都具有相同的效果。從我的列表視圖行項目的源代碼是這樣的:
<ImageView android:id="@id/action_button" android:background="@drawable/action_box"
android:layout_width="25dip" android:layout_height="25dip"
android:layout_alignParentRight="true" android:layout_marginTop="10dip" />
然後我RES /繪製/ action_box.xml是這樣的:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#81c557"
android:endColor="#539942"
android:angle="270"/>
<stroke android:width="1dip" android:color="#a8d78a" />
你重寫,或做任何特殊的ListView適配器的getView方法嗎? – 2010-06-22 22:21:25
你有沒有使用'hierarchyviewer'來確定你的'ImageView'是否丟失,不可見,被拖出屏幕等? – CommonsWare 2010-06-22 22:47:27
是否解決了?你也不需要使用ImageView;你可以使用視圖與android:背景。 – 2010-08-03 02:27:21