记录一下《猜歌猜谜》应用主要使用的开源库

记录一下《猜歌猜谜》应用主要使用的开源库

1、底部导航栏使用开源库是:bottom-navigation-bar

      主要代码实现:

        bottomNavigationBar = (BottomNavigationBar) findViewById(R.id.bottom_navigation_bar);
    bottomNavigationBar.setMode(BottomNavigationBar.MODE_FIXED);
    /*bottomNavigationBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_RIPPLE);
    bottomNavigationBar.setBarBackgroundColor("#FFF5F7F6");//设置bar背景颜色FFEBF0F4*/
    bottomNavigationBar.setActiveColor(R.color.black);//设置被选中时的颜色
    bottomNavigationBar.setInActiveColor(R.color.colorPrimary);//设置未被选中时的颜色

    bottomNavigationBar.addItem(new BottomNavigationItem(R.mipmap.ic_tj, "推荐"))
            .addItem(new BottomNavigationItem(R.mipmap.ic_cgq, " 猜歌曲"))
            .addItem(new BottomNavigationItem(R.mipmap.ic_cmy, "猜谜语"))
            .addItem(new BottomNavigationItem(R.mipmap.ic_sz, "设置"))
            .initialise();
    bottomNavigationBar.setTabSelectedListener(this);

2、头部轮播图使用的开源库是:youth.banner

 主要代码实现:

     Banner banner = (Banner) findViewById(R.id.banner);
     banner.setImages(imglist)
            .setImageLoader(new GlideImageLoader())
            .start();
     banner.updateBannerStyle(BannerConfig.CIRCLE_INDICATOR);
     banner.setBannerAnimation(CubeOutTransformer.class);

3、图片加载使用的开源库是:.bumptech.glide

      主要代码实现:

           Glide.with(context.getApplicationContext())
            .load(path)
            .into(imageView);

4、制作圆形图片使用的开源库是:hdodenhof:circleimageview
项目build中依赖:compile 'de.hdodenhof:circleimageview:2.1.0'

   ImageView图片控件布局代码换成circleimageview控件,如下代码实现:

          <de.hdodenhof.circleimageview.CircleImageView
    android:id="@+id/iv_img"
    android:layout_width="66dp"
    android:layout_height="66dp"
    android:layout_gravity="center"
    android:gravity="center"
    android:src="@drawable/game_disc" />

猜你喜欢

转载自blog.51cto.com/1206995290qq/2157727