General constant menu in the application

孤人 提交于 2019-12-24 09:26:49

问题


I'm developing an Android application that has 10 different activities with the same constant menu at the bottom of their screen. Is fragments is the best way to build the menu or just build a base activity class that all the activities inherits from it?

thanks.


回答1:


You should create a class let say MyBaseActivity that extends Activity and in that class take care of displaying that menu etc.

Then you should let all your Activities in your application extend your custom MyBaseActivity.




回答2:


It depends on how the bottom line should behave on activity changes. If you want it not to move, you habe to use fragments. For pre-Honeycomb devices you'll need the Android Compatibility package provided in the SDK.

If you don't care that the bottom line will be destroyed and recreated on every change of activity, your way to go is as Ovidiu Latcu wrote extending a BaseActivity which provides just the bottom line.



来源:https://stackoverflow.com/questions/8727622/general-constant-menu-in-the-application

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