布局文件
<com.hjm.bottomtabbarold.BottomTabBar
android:id="@+id/bottom_tab_bar"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.hjm.bottomtabbarold.BottomTabBar>
代码调用
mb=(BottomTabBar)findViewById(R.id.bottom_tab_bar);
mb.init(getSupportFragmentManager())
.setImgSize(60,60)//设置图片尺寸
.setFontSize(12)//设置字体尺寸
.setTabPadding(10,6,10)
.setChangeColor(Color.BLUE,Color.GRAY)//设置选中和未选中的颜色
.addTabItem("标题1",R.mipmap.my_select,R.mipmap.my_normal, Fragment1.class)
.addTabItem("标题2",R.mipmap.mystudy_select,R.mipmap.mystudy_normal, Fragment2.class)
.isShowDivider(true)
.setOnTabChangeListener(new BottomTabBar.OnTabChangeListener() {
@Override
public void onTabChange(int position, String name, View view) {
}
});
loadingDialog = new LoadingDialog(ViewsActivity.this, true);
loadingDialog.show();
img = (CornerImageView) findViewById(R.id.img);
//图片圆形加载
Glide.with(this).load("")
.error(this.getResources().getDrawable(R.mipmap.white))
.placeholder(this.getResources().getDrawable(R.mipmap.white))
.transform(new CenterCrop(this), new GlideCircleTransform(this))
.into(img);
//图片圆角加载
img2 = (ImageView) findViewById(R.id.img2);
Glide.with(this).load("https://www.baidu.com/img/bd_logo1.png")
.error(this.getResources().getDrawable(R.mipmap.white))
.placeholder(this.getResources().getDrawable(R.mipmap.white))
.transform(new CenterCrop(this), new GlideRoundTransform(this))
.into(img2);
private CustomDialog commondialog;
private void showDialog() {
commondialog = new CustomDialog(this);
commondialog.show();
commondialog.setMessage("毛春江帅吗?");
commondialog.setTitle("提示");
commondialog.setCancleText("不帅");
commondialog.setConfirmText("帅");
commondialog.setConfirmColor(R.drawable.btn_blue_click_color);
commondialog.setCancleColor(R.drawable.btn_c333333_click_color);
commondialog.setYesOnclickListener(new CustomDialog.onYesOnclickListener() {
@Override
public void onYesClick() {
commondialog.dismiss();
}
});
commondialog.setNoOnclickListener(new CustomDialog.onNoOnclickListener() {
@Override
public void onNoClick() {
}
});
}
*完成自定义导航栏功能,其中包括Fragment切换功能,版本v1.0.0
*引用方式:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.githubmcj:myview:v1.0.0'
}
*添加圆角控件、添加普通提示框、删除多余依赖库、添加glide库
*引用方式:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.githubmcj:myview:v1.0.1'
}