Three steps. Android Application bottom navigation bar

Source: Internet
Author: User

Many Android apps have a bottom navigation bar at the bottom, which makes it easy for users to switch during use. At present, there are three kinds of practice: one is to use custom tabhost, one is to use Activitygroup, one is to combine framelayout implementation. The author has done a variety of applications, in order to save the development cycle, encapsulated an abstract class, as long as the three steps can be completed in the bottom column of the generation and different page calls.

public class Activitycollectiondemoactivity extends Activitycollection {

/** called the activity is a. */

@Override

public void OnCreate (Bundle savedinstancestate) {

Super.oncreate (savedinstancestate);

Setbottomtabbackground (RESID)//Set bottom navigation background map

}

@Override

Protected Boolean isshowwindowfeature () {

Return true;//Set whether title is displayed;

}

@Override

Protected List setdrawablecollections () {

List Indicatorinfos = new ArrayList ();

Indicatorinfo indicatorinfo_1 = new Indicatorinfo (r.drawable.baby1,

r.drawable.baby1_s, R.string.baby1, Color.White,

New Intent (Activitycollectiondemoactivity.this,

Activity01.class));

Indicatorinfo indicatorinfo_2 = new Indicatorinfo (R.drawable.baby2,

r.drawable.baby2_s, R.string.baby2, Color.White,

New Intent (Activitycollectiondemoactivity.this,

Activity02.class));

Indicatorinfo indicatorinfo_3 = new Indicatorinfo (R.drawable.baby3,

r.drawable.baby3_s, R.string.baby3, Color.White,

New Intent (Activitycollectiondemoactivity.this,

Activity03.class));

Indicatorinfo indicatorinfo_4 = new Indicatorinfo (R.drawable.baby4,

r.drawable.baby4_s, R.string.baby4, Color.White,

New Intent (Activitycollectiondemoactivity.this,

Activity04.class));

Indicatorinfos.add (indicatorinfo_1);

Indicatorinfos.add (indicatorinfo_2);

Indicatorinfos.add (Indicatorinfo_3);

Indicatorinfos.add (Indicatorinfo_4);

return Indicatorinfos;

}

Step one: Import jar packs

Step two: Let your homeactivity inherit the Activitycollection class

The third step: your picture resources and jump intent into the list , set options

Ok, a prototype of the application with the bottom navigation bar is out, to deal with the general application is enough, you can spare more time to consider the business logic.

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.