如何使标题 - 内容 - 页脚布局的Android与底部
问题描述:
页脚棍这是我的活动版面内容:如何使标题 - 内容 - 页脚布局的Android与底部
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:id="header"
android:layout_width="fill_parent"
android:layout_height="50">
<TextView
android:layout_width="fill_parent "
android:layout_height="wrap_content"
android:text="Header"
android:textSize="40dp" />
</RelativeLayout>
<RelativeLayout
android:id="main-content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Content" />
</RelativeLayout>
<RelativeLayout
android:id="footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Footer"
android:textSize="40dp" />
</RelativeLayout>
</RelativeLayout>
页脚已经坚持到了谷底,但内容被贴到顶部而不是在“标题”之后。我想过使用“线性布局”,但它没有android:layout_alignParentBottom =“true”。我必须做什么?
答
只需将页眉的布局与父窗口对齐即可。 然后对齐标题下方的主要内容。
让我编辑你,但我会让你测试它..
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="header"
android:id="@+id/rl_header"
android:layout_width="fill_parent"
android:layout_height="50"
android:layout_alignParentTop="true">
<TextView
android:layout_width="fill_parent "
android:layout_height="wrap_content"
android:text="Header"
android:textSize="40dp" />
</RelativeLayout>
<RelativeLayout
android:id="main-content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_header">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Content" />
</RelativeLayout>
<RelativeLayout
android:id="footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Footer"
android:textSize="40dp" />
</RelativeLayout>
</RelativeLayout>