Android bottom menu simple application

There are many ways to realize menu function in Android. Options menu: the menu displayed when the user presses the menu button. Context menu: when the user presses the screen for a long time, the displayed menu is also called context menu. Submenu: submenu. However, sometimes these built-in menus can not meet our functions, so we need to customize a menu ourselves. Next, I'm talking about the menu through the combination of tabhost and radiogroup. This is also a common bottom menu practice. Start with the above figure:

XML code

It should be noted that if you use the tabhost control, several IDS must be written like this, Android: id = "@ Android: ID / tabhost; android:id=”@android:id/tabcontent” ; android:id=”@android:id/tabs” ; This is because in the tabhost class. You need to instantiate the control with this ID. Look at the source code:

Is there a method in tabacity:

When the content changes, it will call this method to update the list or other views. In this method, tabhost needs to be instantiated, so it must be instantiated with ID tabhost.

Look at the tabhost class

This method is called by the system before adding tabs. In this method, you need to instantiate a tabwidget through the ID of tabs and a FrameLayout through the ID of tabcontent to place the tab content. So these two IDs are also fixed.

In the above layout file, the system default widget is hidden and replaced by a button with a picture.

Take a look at the main code:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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
分享
二维码
< <上一篇
下一篇>>