我使用文件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