未显示java LinearLayout
为什么我看不到最后一条直线的布局
<LinearLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
安卓:layout_width="wrap_content" 安卓:background="@drawable/bg" 安卓:layout_height="wrap_content"
安卓:orientation="vertical" 安卓:padding="2dp"
安卓:theme="@安卓:style/Theme.NoTitleBar">
<LinearLayout 安卓:layout_width="fill_parent" 安卓:layout_height="wrap_content" .../>
<ScrollView 安卓:layout_width="wrap_content" 安卓:layout_height="wrap_content">
<TableLayout 安卓:layout_width="fill_parent" 安卓:layout_height="wrap_content">
// TableRows created dynamically
</TableLayout>
</ScrollView>
<LinearLayout 安卓:layout_height="wrap_content" 安卓:layout_width="fill_parent" 安卓:layout_gravity="bottom">
<Button 安卓:layout_height="wrap_content"
安卓:layout_width="wrap_content" 安卓:text="Button" 安卓:id="@+id/button1"></Button>
</LinearLayout>
</LinearLayout>`
编辑:安卓:layout\u gravity=“bottom”
# 1 楼答案
我对android的布局不太满意,但我认为这可能是因为你的ScrollView里有什么。您将ScrollView的参数设置为wrap_内容,这意味着它将根据其子项的需要而变大。但是嵌套的TableLayout使用fill_parent,所以ScrollView“继承”了它并填充了整个屏幕。再一次,我不能保证这是正确的
# 2 楼答案
这种情况会发生,因为您将子元素放在第一个线性布局中,滚动视图可能比屏幕包含更多的空间,因此此线性布局的最后一个子元素没有更多的空间用于查看
对于该解决方案,您可以根据自己的要求选择该视图的相对布局,或者为所有子视图设置布局权重。我认为最后一个选择是为美国队击球
# 3 楼答案
因为最有可能的是上一个线性布局上面的内容太大了,以至于没有足够的空间来显示最后一个线性布局和它的按钮