我正在尝试在Android中获得一个非常简单的布局,但我就是不能让它工作。我想要的只是一个标题(通过
我已经尝试过使用
include
一个XML文件),接着是一个ScrollView
来显示大量文本内容,并且在底部有两个按钮,应该始终可见。我已经尝试过使用
LinearLayout
和RelativeLayout
,但不知何故,我无法让它正常工作。到目前为止,我所拥有的是这个:<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include layout="@layout/header" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ScrollView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/svDisclaimer"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tvDisclaimer">
</TextView>
</ScrollView>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/svDisclaimer"
>
.. [ snip ] ..
</LinearLayout>
</RelativeLayout>
</LinearLayout>
(..[snip].. 是我的按钮所在的位置) 头部显示正常,滚动视图也弹出了,但是按钮却不见了。
android:layout_alignParentBottom
将您的按钮与屏幕底部对齐以将它们固定在屏幕底部。 - Samlayout_above
会使应用程序在Choregrapher(无论那是什么)中崩溃。 - Bart Friederichslayout_below
和layout_above
会导致崩溃。奇怪的是其中一个可以工作,而另一个却不行。显然这与将height
设置为fill_parent
有关。当我理解Android布局时,这将是美好的一天:)。感谢您的帮助! - Bart Friederichsbelow
属性,但我并没有明确告诉你删除它。在Android中同时使用above
和below
会导致循环逻辑...很高兴我能帮到你! - Sam