我有一个简单的android布局,包含一个包含tablelayout的scrollview。这个表格显示正常,但我想在scrollview上添加一个静态标题,这样基本上表格中列的标签总是保持在屏幕的顶部。但是,当我在布局文件中的<ScrollView>
之上添加<LinearLayout>
时,它会使其全部消失。scrollview上面的线性布局
任何人都可以发现我的XML文件做错了吗?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="top" >
<LinearLayout
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableLayout
android:id="@+id/mainTable"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</ScrollView>
</LinearLayout>
正因为如此,我没有看到滚动视图或表格布局,但如果我删除了header
的LinearLayout,它显示就好了。
为什么没有设置任何[LinearLayouts](http://developer.android.com/resources/tutorials/views/hello-linearlayout.html)的方向? – Adinia 2011-12-16 19:47:47
因为那正是我需要做的......使它成为答案,所以我可以接受它 – 2011-12-16 19:51:32