答:Janusz
(最佳答案)
我认为你可以试试RelativeLayout.,这样你可以用android:layout_alignParentBottom将button移动到屏幕底部。如果在Relative Layout中,底部没有显示相关内容,或许就是在它之前的layout占据了整个屏幕。如果出现这种情况,你可以最先在layout文件夹中设定view的位置,然后用android:layout_above将其它的内容设置在view之上。这样,底部的view可以占据更多的空间,layout中其它的内容也可以充分显示。
答:Bram Avontuur
在ScrollView中,这种方法不起作用,因为无论ScrollView是否置于底部,RelativeLayout都会重叠。所以,我选择FrameLayout来进行固定:
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:fillViewport="true">
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_weight="1">
答:pseudosudo
你可以在Linear Layout中新建RelativeLayout:
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
android:id="@+id/TextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
android:layout_width="match_parent"
android:layout_height="match_parent">
android:id="@+id/Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/Button"
android:layout_alignParentBottom="true">
答:Timores
Janusz的答案很正确,但是我觉得用RelativeLayouts并不是最佳选择,所以我介绍一种“filler”方法,将TextView设定为空白:
android:layout_width="fill_parent"
android:layout_weight="1" />