洁面仪厂家
免费服务热线

Free service

hotline

010-00000000
洁面仪厂家
热门搜索:
行业资讯
当前位置:首页 > 行业资讯

三步搞定Android应用底部导航栏

发布时间:2020-01-14 23:36:53 阅读: 来源:洁面仪厂家

第1页三步搞定Android应用底部导航栏很多android应用底部都有一个底部导航栏,方便用户在使用过程中随意切换。目前常用的做法有三种:一种是使用自定义tabHost,一种是使用activityGroup,一种是结合FrameLayout实现。笔者再做了多款应用后,为了节约开发周期,封装了一个抽象类,只要三步便可完成底部栏的生成及不同页面的调用。

public class ActivitycollectiondemoActivity extends ActivityCollection {

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

Create(savedInstanceState);

//setBottomTabBackground(resId);// 设置底部导航背景图

@Override

protected boolean isShowWindowFeature() {

return true;//设置是否显示title;

@Override

protected ListIndicatorInfo> setDrawableCollections() {

ListIndicatorInfo> IndicatorInfos = new ArrayListIndicatorInfo>();

IndicatorInfo indicatorInfo_1 = new IndicatorInfo(by1,

by1_s, by1, 12, ITE,

new Intent(is,

ass));

IndicatorInfo indicatorInfo_2 = new IndicatorInfo(by2,

by2_s, by2, 12, ITE,

new Intent(is,

ass));

IndicatorInfo indicatorInfo_3 = new IndicatorInfo(by3,

by3_s, by3, 12, ITE,

new Intent(is,

ass));

IndicatorInfo indicatorInfo_4 = new IndicatorInfo(by4,

by4_s, by4, 12, ITE,

new Intent(is,

ass));

d(indicatorInfo_1);

d(indicatorInfo_2);

d(indicatorInfo_3);

d(indicatorInfo_4);

return IndicatorInfos;

第一步:导入jar包

第二步:让你的homeactivity 继承ActivityCollection类

第三步:将你的图片资源及跳转intent放入list中,设置可选项

Ok,一个含有底部导航栏的应用雏形就出来了,对付一般的应用足够,你可以腾出更多的时间考虑业务逻辑。

名医汇

名医汇

挂号平台有哪些