# BottomNavigationView
**Repository Path**: tyoli/BottomNavigationView
## Basic Information
- **Project Name**: BottomNavigationView
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-01-04
- **Last Updated**: 2024-11-25
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
## 简介
一个简单的底部导航栏,可以快速集成,简单易用
## 问题反馈
欢迎大家加入群组讨论。
![qq_img][qq_img]
## 使用效果
## 集成方式
### gradle
Step 1. Add the dependency
```
dependencies {
implementation 'com.winton:bottomnavigationview:1.0.0'
}
```
## 用法
### XML布局
```
```
### 添加module
```java
NavigationView mNV = findViewById(R.id.nv);
List tabs = new ArrayList<>();
tabs.add(new NavigationView.Model.Builder(R.mipmap.ic_launcher,R.mipmap.ic_launcher).title("主页").build());
tabs.add(new NavigationView.Model.Builder(R.mipmap.ic_launcher,R.mipmap.ic_launcher).title("tab1").build());
tabs.add(new NavigationView.Model.Builder(R.mipmap.ic_launcher,R.mipmap.ic_launcher).title("tab2").build());
mNV.setItems(tabs);
/*在此处监听,可获取到第一次选中到结果*/
mNV.build();
//mNV.check(0); //2.2 版本之后默认选中0
```
### 添加监听
```java
mNV.setOnTabSelectedListener(new NavigationView.OnTabSelectedListener() {
@Override
public void selected(int i, NavigationView.Model model) {
Toast.makeText(MainActivity.this,model.getTitle(),Toast.LENGTH_LONG).show();
}
@Override
public void unselected(int i, NavigationView.Model model) {
}
});
```
### 显示新消息
```
/**
* 第一个参数代表Item的位置
* 第二个参数代表是否显示红点
* 第三个参数代表红点第内容
**/
mNV.reminder(0,true,"99");
mNV.reminder(1,true,"···");
mNV.reminder(2,true,"");
```
## 参数说明
app:iconSize 图标大小
app:textSize 文字大小
app:activeTextColor 选中时文字颜色
app:unactiveTextColor 未选中时文字颜色
app:icon_margin_top 距离顶部的距离
app:text_margin_bottom 距离底部的距离
app:lineColor 分割线到颜色
app:showLine 是否显示风割线
## License
Copyright 2018 Winton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
[logo]: https://github.com/wintonBy/BottomNavigationView/blob/master/app/screen/BNV.png
[qq_img]: https://github.com/wintonBy/BottomNavigationView/blob/master/app/screen/qq.png