I want to add the same header for navigation to all the pages on the app.
It should look something like this:
----------------------------
Button1 Button2 Button3
----------------------------
Content content content
...
How can I do that?
So far I found something like this to my existing layouts:
<include android:id="@+id/header"
layout="@layout/my_header"
android:layout_height="wrap_content"
android:layout_width="fill_parent"/>
But I am not sure how to put the buttons across the top of the header or how to structure that layout.
Any idea what I can do?
Also, for the buttons that will be present on the header, should I add a listener to every page for each of those buttons?
Also, I made this header:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="5dip">
<Button android:id="@+id/home"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Home"
android:layout_centerHorizontal="true" />
<Button android:id="@+id/questions"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="My Questions"
android:layout_centerHorizontal="true" />
<Button android:id="@+id/businesses"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="My Businesses"
android:layout_centerHorizontal="true" />
<Button android:id="@+id/learn"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Learning Center"
android:layout_centerHorizontal="true" />
<Button android:id="@+id/extra_help"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Extra Help"
android:layout_centerHorizontal="true" />
</RelativeLayout>
But all the buttons show up on top of each other instead of next to each other. How could that be solved?
Thanks!
1 Answer