1
  1. All I want to do is creating a simple header and footer in my android activity(Screen). I have used RelativeLayout in my UI.
  2. And also if I wanted to add a popup Menu in header how would I do that.

Please answer both question separately. Thanks

harshit
  • 3,788
  • 3
  • 31
  • 54
Nadeem
  • 227
  • 1
  • 4
  • 14
  • Point 1) possible duplicate of Point 2) There are several ways to do that: - PopupMenu Class (see android Docs) - Create custom dialog (see android Docs) – Yngwie89 Oct 04 '12 at 06:51

2 Answers2

0
For Header You can make an activity_header.xml Class. & it will include in other classes like as-



<include
        android:id="@+id/header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        layout="@layout/activity_header" />


& for Footer you can use Tab Bar:-
see this:-
http://www.technotalkative.com/android-tab-bar-example-1/
Deepanker Chaudhary
  • 1,694
  • 3
  • 15
  • 35
0
You can use like as:activity_header.xml Or You can use RelativeLayout  for this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@drawable/header"
    android:orientation="horizontal" >

    <LinearLayout
        android:id="@+id/ll_header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|bottom"
        android:layout_marginBottom="2dip"
        android:layout_weight="1"
        android:clickable="true"
        android:gravity="center_vertical|center_horizontal"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/img_header_icon"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:src="@drawable/header_logo" />


    </LinearLayout>

</LinearLayout>
Deepanker Chaudhary
  • 1,694
  • 3
  • 15
  • 35
  • first I have created this file in layout folder .. Then I have included it in xml file of my Main activity but no header is shown – Nadeem Oct 04 '12 at 07:58