Android creating Bottom Bar Menu

☆樱花仙子☆ 提交于 2020-01-13 20:38:30

问题


I want to have an static bottom menu bar exist through out the applications in every page visible at bottom all the time. I have designed the menu bar but i am confused whether i have to integrate the menu code with every layout xmls to make menu visible in every page and write the code in every activity class to perform functions on menu clicks. Or if there is any other way i can create a common bottom bar that lies with every page with writing the code of menu in a single activity class.


回答1:


Well the best way in my opinion , is to create a bottom bar xml file , and include it in every Activity's xml file

<include android:layout_width="fill_parent" layout="@layout/bottom_bar" />

where your bottom bar xml file name is bottom_bar.xml

This article also might help you

http://android-developers.blogspot.com/2009/02/android-layout-tricks-2-reusing-layouts.html




回答2:


There is also the include route:

  • Common layout in all tabs



回答3:


What you are probably looking for is one Activity with a TabBar with tabs at the top and buttons at the bottom: Android: Tabs at the BOTTOM

Then you can use different Views that correspond to Tabs instead of separate Activities.



来源:https://stackoverflow.com/questions/5548554/android-creating-bottom-bar-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!