作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的布局中的 ScrollView
有一个奇怪的问题,即它切断了 TableLayout
的底部。这是它的样子when scrolling to the top.
带圆角的绿色背景应该与底部相同,即它实际上只是一个带圆角的普通矩形可绘制对象。但是当我尝试滚动到底部时,here's what I see:
如您所见,底角是不可见的,我不能再滚动了。现在,我只能看到 Comments 部分的所有行,因为我手动添加了一些 android:paddingBottom
到 TableLayout
(见下文),否则更多内容会被截断。我只是想不通,问题是什么。有人可以告诉我我错过了什么吗?这是 XML 布局。它由运行时的数据库查询填充。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableLayout
android:id="@+id/table"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="30dp"
android:background="@drawable/some_shape"
android:paddingBottom="40dp" >
<TableRow android:layout_margin="20dp" >
<TextView
android:id="@+id/code_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:text="Code:" />
<TextView
android:id="@+id/code_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test" />
</TableRow>
<TableRow android:layout_margin="20dp" >
<TextView
android:id="@+id/name_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:text="Name:" />
<TextView
android:id="@+id/name_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test" />
</TableRow>
<TableRow android:layout_margin="20dp" >
<TextView
android:id="@+id/pra_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:text="Type:" />
<TextView
android:id="@+id/pra_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test" />
</TableRow>
<TableRow android:layout_margin="20dp" >
<TextView
android:id="@+id/day_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:text="Day:" />
<TextView
android:id="@+id/day_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test" />
</TableRow>
<TableRow android:layout_margin="20dp" >
<TextView
android:id="@+id/room_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:text="Room:" />
<TextView
android:id="@+id/room_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test" />
</TableRow>
<TableRow android:layout_margin="20dp" >
<TextView
android:id="@+id/time_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:text="Time:" />
<LinearLayout android:orientation="horizontal" >
<TextView
android:id="@+id/time_field1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="@string/to" />
<TextView
android:id="@+id/time_field2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test2" />
</LinearLayout>
</TableRow>
<TableRow android:layout_margin="20dp" >
<TextView
android:id="@+id/comment_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:text="Comments:" />
<TextView
android:id="@+id/comment_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test" />
</TableRow>
</TableLayout>
</ScrollView>
最佳答案
我知道为时已晚,但答案是从 TableLayout 中删除 android:layout_margin="30dp"
关于android - ScrollView 截掉部分布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19576762/
我是一名优秀的程序员,十分优秀!