Reputation: 9681
I want to have a common bottom bar in Android. If any of the button is clicked then it should open up the new activity with bottom bar still at the bottom. Is there any way to achieve this? I have tried having a superclass with 4 buttons at the bottom and then opening new activity on click event but I do not know why the bottom bar is not displayed and also is this is the proper approach?
Upvotes: 0
Views: 796
Reputation: 38727
The way I did this was to have a single Activity
consisting of a ViewFlipper
which occupied most of the window, and the button bar at the bottom. The child "activities" were simply children of the ViewFlipper
. Worked fine.
EXAMPLE ADDED LATER:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<ViewFlipper
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
>
<!-- Your pages go here, i.e.: -->
<include android:id="@+id/page1" layout="@layout/page1" />
<include android:id="@+id/page2" layout="@layout/page2" />
...
</ViewFlipper>
<!-- Your bottom bar -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
... buttons or whatever you want here ...
</LinearLayout>
</LinearLayout>
Upvotes: 1