Adding custom horizontal menu in android is tricky part but not much difficult. In this tutorial, I am going to show how to implement custom horizontal icons menu in android application with one of the best and easy ways. For this you not need to have good knowledge of java code.

To add custom icons menu in your android application here I am working with XML code and few java code also. Here I have used Buttons, ImageButtons, TextViews, RelativeLayout and LinearLayout in XML activity layout file and also created a XML drawable file inside res/drawable directory to change the background color of icons/buttons when user click/press the icon.

Android Custom Vertical Dropdown Icons Menu
Changing Background and Text Color of Android ActionBar Option Menu
Android Spinner Example

Android Example: How to Make Custom Horizontal Icons Menu in Android

Following is the complete necessary XML and Java code of different file.

XML Layout File

This is the main XML layout file where I have added text view, button and image buttons inside linear and relative layout.


Java Activity File

In java activity file we are going to control on dropdown button click event to show and hide dropdown menu items when button is click.


XML Drawable File

Create a new XML file onclick_press_color.xml in res/drawable of your application project and add the following content to change the background color of dropdown items when users click on dropdown items.


And following is the different color value of res/values/colors.xml file.


Android Example: How to Make Custom Horizontal Icons Menu in Android

Now, run your Android Custom Horizontal Icons Menu application and click the dropdown button which will look like the above screenshot.

Post a Comment

Powered by Blogger.