Android Implementation 360 mobile phone assistant at the bottom of the animated menu _android

Source: Internet
Author: User
Tags xml attribute

First, let's look at the results we've achieved and compare the 360 effects:

360 Mobile Helper Effect Demo

The effect of the library implementation (icon from 360 Mobile phone helper, the invasion of the deletion)

XML layout file

Note: In order to be beautiful, speak the height of each button and fixed, set wrap_content time is the maximum height, 50DP, if you need to set a specific height see the method table below

<com.brioal.bottomtab.view.bottomlayout
    android:id= "@+id/main_tab"
    android:layout_width= "Match_ Parent "
    android:layout_height=" wrap_content "
    android:layout_alignparentbottom=" true ">

  </ Com.brioal.bottomtab.view.bottomlayout>

Data source additions and basic settings

 Mlist = new arraylist<> ();
    Mlist.add (New Tabentity (r.mipmap.icon_1, "recommended"));
    Mlist.add (New Tabentity (R.mipmap.icon_2, "game"));
    Mlist.add (New Tabentity (R.mipmap.icon_3, "Software"));
    Mlist.add (New Tabentity (R.mipmap.icon_4, "Application Circle"));
    Mlist.add (New Tabentity (R.mipmap.icon_5, "management")); Mbottomlayout.setlist (mlist); Set the data source Mbottomlayout.setnews (1, 0);
    Set unread message Mbottomlayout.setnews (2, 1);
    Mbottomlayout.setnews (3, 2);
    Mbottomlayout.setnews (4, 3);
    Mbottomlayout.setnews (5, 4); Set Item Click event Mbottomlayout.setselectedlistener (New Ontabselectedlistener () {@Override public void Onselec Ted (int position) {mbottomlayout.cleannews (position);//Clear Unread message if (Mtoast = = null) {Mtoast = T
        Oast.maketext (mainactivity.this, Position + "", toast.length_short);
        else {mtoast.settext (position + "");
      } mtoast.show (); 
}
    });

The effect after this setting is as shown in the example diagram so that it is already available for basic use, and this library also offers other customizations, as follows:

XML attribute Java methods Function
Colornormal colornormal void setcolornormal (int colornormal) Set the color of icon and text when unchecked
colorselected Setcolorselect (int colorselect) Set the color of icon and text when selected
Textsize settextsize (int textsize) Set the size of the font
Excirclecolor Setexcirclecolor (int excirclecolor) Set Outer Circle Color
Incirclecolor Setincirclecolor (int incirclecolor) Set the inner circle color
Animduration Setduration (int duration) Set the length of the animation when clicking Ripples
No void setlist (list<tabentity> List) Set data source, format as resource file, menu name
No void setmenuheight (int height) Set menu height, default to 50DP, suitable height
No void SetCurrentIndex (int currentindex) Set the selected Tab button to the following table
No Setselectedlistener (Ontabselectedlistener Selectedlistener) Set Item Click event
No Setnews (int newsum, int index) Sets the number of unread messages for the specified item
No Cleannews (int index) Clears unread messages for the specified item

How to add this component to your project:

Step 1. The Build.gradle file for the project is modified as follows

allprojects {
    repositories {
      ...
      Maven {URL ' Https://jitpack.io '}}}
  

Step 2. Add dependencies

dependencies {
      compile ' com.github.brioal:bottomtablayout:1.1 '
  }

Summarize

This is the full content of this article, I hope you can help Android developers, if you have questions you can leave a message exchange.

Related Article

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.