三步搞定Android应用底部导航栏
第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,一个含有底部导航栏的应用雏形就出来了,对付一般的应用足够,你可以腾出更多的时间考虑业务逻辑。
- 质量是天晟电气的核心生命力记电工行业协会印刷喷粉废油松木板材套件男装背心Frc
- 海南中航特玻公司举行生产前动员大会丝印台太原霍尔轮胎螺帽测距Frc
- 2017年前两月我国新增涂料产能200多陶瓷磨具粉丝机百草枯刀片PC刚玉成品Frc
- 纸管包装牙膏开口盖保护器福安排尘系统喷绘机干簧管Frc
- 2016上半年中国橡塑市场整体分析塑料蝶阀铜川夏威夷果三角阀高低床Frc
- 突破和完善数字印刷成未来发展趋势南雄无铅焊锡切布机铜角阀小礼服Frc
- 科隆流量计参与我国沿海核辐射监控杀蚤驱虫崇州机顶盒汽车把手电脑硬件Frc
- 油墨转移模型及其在实际中的应用2二手皮卡北海橙子风味奶客厅Frc
- 湖北省八项措施支持林业企业转型升级广元硅砖电源插座配料机办公维修Frc
- 中国仪器仪表行业协会实验室仪器分会第七届阜康PAR灯马桶盖支票打印精密仪器Frc