0

Can anybody tell me how to set a footer to all the activities in the application with dynamic data based on activity loaded?

I need to change the footer text to selected student from the listview for all the activities and if no student selected display "GUEST"

Khushi
  • 73
  • 1
  • 9
  • You can use fragment activity and in which set your footer from entire your app use fragment you can change footer from anywhere. – Ajay Pandya Feb 04 '16 at 08:05
  • can you please provide me the example, i have been trying this, but unable to align fragment to the bottom of the parent activity and background image is also missing. – Khushi Feb 04 '16 at 08:10

2 Answers2

0

make one footer.xml and include it to all activity.xml where you want to show it. then depending on your requirement you can make changes.

Rajesh Satvara
  • 3,842
  • 2
  • 30
  • 50
0

Just Look Over this xml it is simple xml for your requirement here in frame container you can replace all your fragments.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:background="@color/blue">

    <ImageView

        android:layout_width="@dimen/main_drawer_icon"
        android:layout_height="@dimen/main_drawer_icon"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginBottom="@dimen/library_screen"
        android:layout_marginLeft="@dimen/smallText"
        android:src="@mipmap/arrow_left_white"
        android:visibility="gone" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text=" Header"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/white" />

    </RelativeLayout>

<View
    android:layout_width="match_parent"
    android:layout_height="5dp"
    android:background="@color/orange"></View>

<FrameLayout
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_weight="0.90"
    android:layout_height="0dp">


   <--  Replace here yout fragments -->


</FrameLayout>


<View
    android:id="@+id/viewDestination"
    android:layout_width="match_parent"
    android:layout_height="0.01dp"
    android:background="@color/greyMediumlight" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="0.10"
    android:orientation="vertical">



         <--  This is Footer View -->


</LinearLayout>

Ajay Pandya
  • 2,417
  • 4
  • 29
  • 65