Step 3: complete the navigation bar at the bottom of the android app
Many android applications have a bottom navigation bar at the bottom to facilitate User Switching during use. Currently, there are three common methods: Custom tabHost, activityGroup, and FrameLayout. After I have made multiple applications, I encapsulated an abstract class to save the development cycle. In three steps, I can generate the bottom column and call different pages.
Public class ActivitycollectiondemoActivity extends ActivityCollection {
/** Called when the activity is first created .*/
@ Override
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
// SetBottomTabBackground (resId); // you can specify the background image of the bottom Navigation Pane.
}
@ Override
Protected boolean isShowWindowFeature (){
Return true; // set whether to display the title;
}
@ Override
Protected List SetDrawableCollections (){
List IndicatorInfos = new ArrayList ();
IndicatorInfo indicatorInfo_1 = new IndicatorInfo (R. drawable. baby1,
R. drawable. baby1_s, R. string. baby1, 12, Color. WHITE,
New Intent (ActivitycollectiondemoActivity. this,
Activity01.class ));
IndicatorInfo indicatorInfo_2 = new IndicatorInfo (R. drawable. baby2,
R. drawable. baby2_s, R. string. baby2, 12, Color. WHITE,
New Intent (ActivitycollectiondemoActivity. this,
Activity02.class ));
IndicatorInfo indicatorInfo_3 = new IndicatorInfo (R. drawable. baby3,
R. drawable. baby3_s, R. string. baby3, 12, Color. WHITE,
New Intent (ActivitycollectiondemoActivity. this,
Activity03.class ));
IndicatorInfo indicatorInfo_4 = new IndicatorInfo (R. drawable. baby4,
R. drawable. baby4_s, R. string. baby4, 12, 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 1: import the jar package
Step 2: let your homeactivity inherit the ActivityCollection class
Step 3: add your image resources and jump intent to the list , Set the option
OK, an application containing the bottom navigation bar is ready. It is enough to deal with general applications. You can spend more time considering the business logic.