Reputation: 654
I need to create multiple activities that will have a bar at the bottom of the screen. This bar contains three functions that are common to the activities. Can i keep the bar constantly on screen and switch through activities?
One way could be to load different fragments on the same activity, and let the bar be below the fragments.
But is it possible to switch between activities, without recreating the bar every time a new activity opens?
Upvotes: 0
Views: 260
Reputation: 407
Possible option:
You have to create bottom layout bottomlayout.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/toolBarText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:background="@android:color/transparent"
android:layout_centerInParent="true"
android:text="TOOLBAR TEXT"
android:textColor="#FFFFFF"
android:textSize="15dp" />
</RelativeLayout>
Include bottomlayout in every xml layout of activity.
<include layout="@layout/bottomlayout"/>
Upvotes: 1