1
我有以下代碼在我的代碼中創建表頭。但是,出於某種原因,ImageView列沒有顯示任何內容。由於我對列的權重進行了固定,而不是顯示圖像,所以此代碼僅爲該列保留空白空間,但不顯示任何內容。我懷疑我的drawable是這個的起源,但是如果我創建一個TextView並將其定義爲drawableTop,drawableBottom或這種類型的其他類型,則會顯示它。ImageView不在TableRow上顯示
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp" >
<TableRow>
<TextView
android:layout_margin="1dp"
android:layout_weight="2"
android:background="#ffcccccc"
android:gravity="center"
android:text="@string/date_hour"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:layout_margin="1dp"
android:layout_weight=".75"
android:background="#ffcccccc"
android:gravity="center"
android:drawable="@drawable/road" />
<TextView
android:layout_margin="1dp"
android:layout_weight=".75"
android:background="#ffcccccc"
android:gravity="center"
android:text="@string/op"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:layout_margin="1dp"
android:layout_weight="1"
android:background="#ffcccccc"
android:gravity="center"
android:text="@string/tag"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:layout_margin="1dp"
android:layout_weight="2"
android:background="#ffcccccc"
android:gravity="center"
android:text="@string/status"
android:textSize="16sp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
有人遇到同樣的問題嗎?
檢查您的圖像文件是它應該在哪裏......也嘗試清理您的項目 – 2013-04-22 12:37:17