# IndexBar
**Repository Path**: vanish136_admin/IndexBar
## Basic Information
- **Project Name**: IndexBar
- **Description**: Android 字母索引栏
- **Primary Language**: Android
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 22
- **Forks**: 4
- **Created**: 2017-06-26
- **Last Updated**: 2025-10-28
## Categories & Tags
**Categories**: android-modules
**Tags**: None
## README
# IndexBar
## 效果图

## 使用方式
【最新版本号以[这里](https://github.com/Vanish136/IndexBar/releases)为准】
#### ① 添加Gradle依赖
```
#last-version请查看上面的最新版本号
#1.0.2版本开始后引用方式如下:
implementation 'com.lwkandroid.library:IndexBar:last-version'
#1.0.2版本以前引用方式如下:
implementation 'com.lwkandroid:IndexBar:last-version'
```
#### ② 代码中使用
```
//在xml中定义
//触摸时文字大小,默认15sp
//代码中
IndexBar mIndexBar = (IndexBar) findViewById(indexBar);
//自定义索引数组,默认是26个大写字母
mIndexBar.setTextArray(new CharSequence[]{...});
//添加相关监听
mIndexBar.setOnIndexLetterChangedListener(new IndexBar.OnIndexLetterChangedListener(){
@Override
public void onTouched(boolean touched)
{
//TODO 手指按下和抬起会回调这里
}
@Override
public void onLetterChanged(CharSequence indexChar, int index, float y)
{
//TODO 索引字母改变时会回调这里
}
});
```
**更详细的使用方法可参考Demo**
### 混淆配置
无需额外混淆配置
### 开源参考
1. Demo中实现`指定RecyclerView滚动到指定位置`的参考博客:http://blog.csdn.net/tyzlmjj/article/details/49227601
2. Demo中有引用我另外一个开源项目[RecyclerViewAdapter](https://github.com/Vanish136/RecyclerViewAdapter),只是为了配合演示RecyclerView和IndexBar联动效果,实际开发过程可以去掉该库,两个库之间没有必然依赖(当然也很欢迎你一起了解下)。