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.