- All I want to do is creating a simple header and footer in my android activity(Screen). I have used
RelativeLayout
in my UI. - And also if I wanted to add a popup Menu in header how would I do that.
Please answer both question separately. Thanks
RelativeLayout
in my UI.Please answer both question separately. Thanks
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/
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>