广州市专业网站建设,wordpress开发 书,百度seo详解,免费团购网站模板很多android应用底部都有一个底部导航栏#xff0c;方便用户在使用过程中随意切换。目前常用的做法有三种#xff1a;一种是使用自定义tabHost#xff0c;一种是使用activityGroup,一种是结合FrameLayout实现。笔者再做了多款应用后#xff0c;为了节约开发周期#xff0c…很多android应用底部都有一个底部导航栏方便用户在使用过程中随意切换。目前常用的做法有三种一种是使用自定义tabHost一种是使用activityGroup,一种是结合FrameLayout实现。笔者再做了多款应用后为了节约开发周期封装了一个抽象类只要三步便可完成底部栏的生成及不同页面的调用。Copy to Clipboard引用的内容[www.veryhuo.com]public class ActivitycollectiondemoActivity extends ActivityCollection {/** Called when the activity is first created. */Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);//setBottomTabBackground(resId);// 设置底部导航背景图}Overrideprotected boolean isShowWindowFeature() {return true;//设置是否显示title;}Overrideprotected ListsetDrawableCollections() {ListIndicatorInfos 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;}第一步导入jar包第二步让你的homeactivity 继承ActivityCollection类第三步将你的图片资源及跳转intent放入list中设置可选项Ok,一个含有底部导航栏的应用雏形就出来了对付一般的应用足够你可以腾出更多的时间考虑业务逻辑。jar包及demo请参见jar包及demo