日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

android底部导航栏软件,三步搞定android应用底部导航栏

發(fā)布時(shí)間:2024/8/23 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android底部导航栏软件,三步搞定android应用底部导航栏 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

很多android應(yīng)用底部都有一個(gè)底部導(dǎo)航欄,方便用戶在使用過程中隨意切換。目前常用的做法有三種:一種是使用自定義tabHost,一種是使用activityGroup,一種是結(jié)合FrameLayout實(shí)現(xiàn)。筆者再做了多款應(yīng)用后,為了節(jié)約開發(fā)周期,封裝了一個(gè)抽象類,只要三步便可完成底部欄的生成及不同頁面的調(diào)用。

Copy to Clipboard

引用的內(nèi)容:[www.veryhuo.com]

public class ActivitycollectiondemoActivity extends ActivityCollection {

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

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

//setBottomTabBackground(resId);// 設(shè)置底部導(dǎo)航背景圖

}

@Override

protected boolean isShowWindowFeature() {

return true;//設(shè)置是否顯示title;

}

@Override

protected 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;

}

第一步:導(dǎo)入jar包

第二步:讓你的homeactivity 繼承ActivityCollection類

第三步:將你的圖片資源及跳轉(zhuǎn)intent放入list中,設(shè)置可選項(xiàng)

Ok,一個(gè)含有底部導(dǎo)航欄的應(yīng)用雛形就出來了,對付一般的應(yīng)用足夠,你可以騰出更多的時(shí)間考慮業(yè)務(wù)邏輯。

jar包及demo請參見:jar包及demo

總結(jié)

以上是生活随笔為你收集整理的android底部导航栏软件,三步搞定android应用底部导航栏的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。