<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.hp.myxjd.activity.MainAppActivity"> <com.hjm.bottomtabbar.BottomTabBar android:id="@+id/bottom_tab_bar" android:layout_width="match_parent" android:layout_height="match_parent" app:tab_unselected_color="#000000" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /></LinearLayout>
package com.example.hp.myxjd.activity; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.example.hp.myxjd.fragment.FindFragment; import com.example.hp.myxjd.fragment.HomeFragment; import com.example.hp.myxjd.fragment.MineFragment; import com.example.hp.myxjd.R; import com.example.hp.myxjd.fragment.ShopFragment; import com.example.hp.myxjd.fragment.SortFragment; import com.hjm.bottomtabbar.BottomTabBar; public class MainAppActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_app); getSupportActionBar().hide(); BottomTabBar mBottomTabBar = (BottomTabBar) findViewById(R.id.bottom_tab_bar); mBottomTabBar.init(getSupportFragmentManager()) .addTabItem("首页", R.mipmap.shouye2, R.mipmap.shouye1, HomeFragment.class) .addTabItem("分类", R.mipmap.fenlei2, R.mipmap.fenlei1, SortFragment.class) .addTabItem("发现",R.mipmap.faxian2,R.mipmap.faxian1, FindFragment.class) .addTabItem("购物车", R.mipmap.gouwuche2, R.mipmap.gouwuche1, ShopFragment.class) .addTabItem("我的", R.mipmap.wode2, R.mipmap.wode1, MineFragment.class); } }}) compile 'com.android.support:appcompat-v7:26.+' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.facebook.fresco:fresco:1.5.0' compile 'com.facebook.fresco:animated-gif:1.5.0' compile 'com.android.support:design:26.0.0-alpha1' compile 'com.hjm:BottomTabBar:1.1.1' compile 'com.squareup.okio:okio:1.5.0' compile 'com.squareup.okhttp3:okhttp:3.4.2' compile 'com.xhb:xbanner:1.0.0' compile 'org.greenrobot:eventbus:3.0.0' compile 'com.youth.banner:banner:1.4.9' compile 'com.squareup.okhttp3:logging-interceptor:3.4.1' compile 'com.github.bumptech.glide:glide:4.0.0' compile 'com.google.code.gson:gson:2.8.2' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.squareup.retrofit2:retrofit:2.3.0' compile 'com.squareup.retrofit2:converter-scalars:2.3.0' compile 'com.squareup.retrofit2:converter-gson:2.0.2' compile 'io.reactivex.rxjava2:rxandroid:2.0.1' compile 'io.reactivex.rxjava2:rxjava:2.1.7' compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0' compile 'com.github.bumptech.glide:glide:4.0.0' compile 'com.jakewharton:butterknife:8.8.1' compile 'com.android.support:recyclerview-v7:26.0.0-alpha1' compile 'com.jcodecraeer:xrecyclerview:1.3.2' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' testCompile 'junit:junit:4.12' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
buttomtabbar
最新推荐文章于 2021-06-04 11:02:47 发布