• bottombar——Fragment


    首先是依赖   compile 'com.hjm:BottomTabBar:1.1.1'

       下面是activity。xml文件

    <RelativeLayout 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"
        tools:context="com.example.news.Activity.HomeActivity">
    
        <com.hjm.bottomtabbar.BottomTabBar
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/bar"></com.hjm.bottomtabbar.BottomTabBar>
    </RelativeLayout>

    最后是Main的代码

    public class HomeActivity extends AppCompatActivity {
    
        @InjectView(R.id.bar)
        BottomTabBar bar;
        private static final String Home = "首页";
        private static final String Buy = "西瓜视频";
        private static final String Shop = "微头条";
        private static final String Mine = "我的";
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_home);
            ButterKnife.inject(this);
            bar.init(getSupportFragmentManager())
                    .setImgSize(50, 50)  //底部标题栏图片的大小
                    .setFontSize(15)  //图片下边文字大小
                    .setChangeColor(Color.RED, Color.BLACK) //设置文字的颜色,选中红色,不选中黑色
                    .addTabItem(Home, R.mipmap.a2t, R.mipmap.a2s, Fragment_home.class)//加载Fragment参数,分别是图片下面的文字,选中时候的图片,未选中时候的图片,对应的Fragment类
                    .addTabItem(Buy, R.mipmap.a31, R.mipmap.a30, Fragment_vedio.class)
                    .addTabItem(Shop, R.mipmap.a2z, R.mipmap.a2y, Fragment_headlines.class)
                    .addTabItem(Mine, R.mipmap.a2v, R.mipmap.a2u, Fragment_mine.class)
                    .isShowDivider(false);
        }
    }
  • 相关阅读:
    第8/24周 覆盖索引 临界点
    理解统计信息(1/6):密度向量
    索引碎片检测
    索引碎片
    索引深入浅出(10/10):创建索引时,键列位置的重要性
    索引深入浅出(9/10):过滤索引
    索引深入浅出(8/10):覆盖索引或列包含
    索引深入浅出(7/10):非唯一列上的非聚集索引
    索引深入浅出(6/10):选择正确并合适的聚集索引键
    索引深入浅出(5/10):非聚集索引的B树结构在堆表
  • 原文地址:https://www.cnblogs.com/leshen/p/8124874.html
Copyright © 2020-2023  润新知