【发布时间】:2012-02-22 15:15:41
【问题描述】:
我正在使用文件 main.xml 在 Android 中设计 UI。我不知道为什么最后一个 TextView (id: ImageDescription) 不起作用。如果我删除ImageView 标签,最后一个TextView 将再次起作用。
这是我的截图。第一个在没有ImageView 标签时,第二个在有ImageView 时
如您所见,当有图像时,我看不到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 文档
The TextView class also takes care of its own scrolling, so does not require a ScrollView -
@Selvin 是的。我认为问题不在于
ScrollView,因为当我删除ScrollView标签时,仍然没有什么不同:( -
它非常简单明了...图像太大...顶部和底部似乎有黑条...也许您应该将图像和描述都放在另一个线性布局然后把这个线性布局放到scrollview ...
标签: android android-layout ui-design