Fragmenttabhost usage example

At present, we see that there are four navigation bars at the bottom of wechat. How should we implement similar navigation bars?

In Android 4.0, a new tool, fragment tabhost, was introduced.

Fragment tabhost can customize the style at the bottom. You can add icons or text freely. How do we use it?

First, let's look at mainactivity;

Then let's take a brief look at how fragment is written:

Next, let's look at the specific layout file:

The first is the overall layout:

Next is the layout of the ItemView of the tab:

Finally, the layout of the fragment:

Well, that's it. We're almost finished.

Attach source code: https://github.com/huanshen/Learn-Android/tree/master/fragmentTabHost

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>