Best way to implement tabs in android?

那年仲夏 提交于 2019-11-27 15:51:13

A TabHost cannot contain fragments (well, it can but it's really tricky) so I wouldn't recommend to use it today.

Fragments are the way to go, and if you want to implement the new Tab mechanism (which is integrated to the "new" ActionBar available on Android 3.0) and still support old android versions there is ActionBarSherlock, an open-source project which facilitate the use of the action bar design pattern across all versions of Android with a single API.

A lot of popular apps uses this project nowadays (including Google apps) so it's worth looking at.

A Fragment represents a behavior or a portion of user interface in an Activity.

The android developer guide.

Your question seems to be worded a little strangely. You are asking about Tabs being at the bottom of the page but asking if you should use Fragments. Those are two different topics.

Yes, you should use Fragments, it is the route android is taking and will continue to take for the future.

Having Tabs at the bottom of the screen or at the top is a design decision. Depends on what would be more comfortable for the user experience, really doesn't have a lot to do with Fragments.

Google has introduced a new View called BottomNavigationView, a standard Bottom Navigation bar for android applications. As per guidelines you can add upto 5 (standard) items and pretty much simple as android's NavigationView.

Please do visit Component Guidelines, to know more about designing.

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