我使用文件main.xml
來設計Android中的UI。我不知道爲什麼最後的TextView
(id:ImageDescription)不起作用。如果我刪除ImageView
標記,則最後的TextView
將再次起作用。 這是我的截圖。當沒有ImageView
標籤,而第二時有ImageView
Android佈局無法正常工作
正如你看到的,在第一時有圖像,我看不到線Image descriptor: a cartoon tiger
。 這裏是我的main.xml
:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/imageTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/test_image_title"/>
<TextView
android:id="@+id/imageDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test_image_date"/>
<ImageView
android:id="@+id/imageDisplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/test_contentDescription"
android:src="@drawable/test_image"/>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/imageDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test_image_description"/>
</ScrollView>
</LinearLayout>
感謝幫助我:)
來自ScrollView文檔'TextView類也照顧它自己的滾動,所以不需要ScrollView' – Selvin 2012-02-22 15:30:29
@Selvin是的。我認爲問題不是'ScrollView',因爲當我刪除'ScrollView'標記時,仍然沒有發生任何不同:( – hqt 2012-02-22 15:44:35
它非常簡單明顯......圖像太大......它似乎在頂部有黑條,底部...也許你應該把圖像和desription到另一個linearlayout,然後把這個linearlayout滾動查看... – Selvin 2012-02-22 15:48:35