Android Open Source project--bottom navigation bar with icon text Icontabpageindicator

Source: Internet
Author: User
Tags jcenter

The next blog plan is that some Android open source projects will be sent between the Android official technical document translator, and a few of the remaining Android technical documents are sent out, followed by the Android Open source project and the Gradle translation. Of course, other article notes will be sent occasionally.

This article original, reprint please indicate on the csdn on the source:

http://blog.csdn.net/maosidiaoxian/article/details/42638245

Brief introduction

This article is about a bottom navigation bar called Icontabpageindicator, a navigation bar with icon text.

In fact, this project is only three classes, and it only completes this kind of navigation bar. The project refers to the implementation of the project Viewpagerindicator two years ago by Jakewharton, based on one of the navigation modifications, the navigation bar that implements the icon text, and the size of the icon or text can be set. Do not worry about the big icons to the top of the text or the navigation to the fertilizer.

Why would I know so clearly? Because this is what I wrote, haha.

Use the eclipse user to download the project on their own and then copy the resources and code into the project. Android Studio is simple, just add the Jcenter declaration in the build.gradle of your root project (added without adding it):
    repositories {        jcenter ()    }

Then add the dependencies in the Build.gradle of the app module:
    Compile ' com.githang:iconpagerindicator:1.2 '

Then you can start using it. Use the method and Jakewharton the viewpagerindicator of the great God is exactly the same, if not understand, you can refer to the code of the app module inside the project, there is a complete demo. Here's how to customize the size of the icons.
Custom icon size because Android phone has a variety of screen size, generally we do not use the designer to display the image size directly, will be displayed on the picture width of a DP value set. So here I have also defined two properties to set the width and height of this icon. Use this method by specifying a style of "Tabview" in your Style.xml app theme, and then specifying the value of two attributes in this style, one is "iconwidth" and one is the value of "Iconheight". The code is as follows:
   <style name= "Apptheme" parent= "Theme.AppCompat.Light" >        <item name= "Tabview" > @style/mytabview</ item>    </style>    <style name= "Mytabview" parent= "Tabview" >        <item name= "Iconwidth" > 28dp</item>        <item name= "iconheight" >28dp</item>    </style>

Take a look:

Android Open Source project--bottom navigation bar with icon text Icontabpageindicator

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.