【发布时间】:2012-01-30 07:30:22
【问题描述】:
我需要设计与Adding component at the bottom 中定义的几乎相似的结构
我遵循了该线程中给出的答案。但是我的问题是,如果我使用标签导入另一个在LinearLayout 中有一些组件的xml,并且如果我尝试在我的xml 中添加具有RelativeLayout 的xml,那么使用标签导入的组件将不会转到屏幕底部。但奇怪的是,如果我用某个组件(如同一个 xml 中的按钮)替换那个导入的组件,按钮就会移到底部。请帮帮我。
这是代码-
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!-- Title Bar -->
<include
android:layout_alignParentTop="true"
android:id="@+id/title_bar"
layout="@layout/title_bar"
android:layout_marginBottom="1dip"/>
<!-- Options Bar -->
<include
android:layout_alignParentBottom="true"
android:id="@+id/options_bar"
layout="@layout/options_bar"
/>
<!--
<Button android:layout_alignParentBottom="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test"/>
-->
</RelativeLayout>
【问题讨论】:
-
也请分享 options_bar 布局。我认为 option_bar 高度存在问题(可能是“fill_parent”)。
-
@Arslan:非常感谢。它解决了我的问题。使用“match_parent”而不是“fill_parent”。
标签: android android-linearlayout android-relativelayout