gpt4 book ai didi

android - ScrollView 截掉部分布局

转载 作者:行者123 更新时间:2023-11-29 00:25:49 25 4
gpt4 key购买 nike

我的布局中的 ScrollView 有一个奇怪的问题,即它切断了 TableLayout 的底部。这是它的样子when scrolling to the top.

带圆角的绿色背景应该与底部相同,即它实际上只是一个带圆角的普通矩形可绘制对象。但是当我尝试滚动到底部时,here's what I see:

如您所见,底角是不可见的,我不能再滚动了。现在,我只能看到 Comments 部分的所有行,因为我手动添加了一些 android:paddingBottomTableLayout(见下文),否则更多内容会被截断。我只是想不通,问题是什么。有人可以告诉我我错过了什么吗?这是 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com