# IndexBar
**Repository Path**: ThinkingAndroid/IndexBar
## Basic Information
- **Project Name**: IndexBar
- **Description**: 一个Android自定义控件-----通讯录的索引条
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 59
- **Created**: 2016-07-22
- **Last Updated**: 2024-06-03
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
IndexBar
========
## 安装
添加这个依赖到你的'build.gradle'(available from mavenCentral and jcenter)
```gradle
compile 'io.github.brightyoyo:indexbar:1.0.0'
```
### 描述
仿微信通讯录索引条
### 微信通讯录截屏

### Demo

### 整合到程序
**1)** 添加IndexBar到你的布局文件中。
* indexBarColorNormal IndexBar没被点击时的背景色*
* indexBarColorPressed IndexBar被点击时的背景色*
* alphabetTextColor IndexBar上每个索引字符的颜色*
* alphabetTextSize IndexBar上每个索引字符的字符大小*
* alphabetPadding IndexBar上索引字符的间距*
* indexBarRound IndexBar圆角的大小*
* withinIndexBar 是否在IndexBar外也可以索引*
**2)** 在Activity或Fragment中对IndexBar实例化,注册监听器
```java
mIndexBar.setIndexBarFilter(new IndexBar.IIndexBarFilter() {
/**
* @param sideIndexY 滑动IndexBar的Y轴坐标
* @param position 字母的索引位置
* @param previewText 手指触摸的字母
*/
@Override
public void filterList(float sideIndex, int position, String previewText) {
Integer selection = mSections.get(previewText);
if (selection != null) {
mPreviewText.setVisibility(View.VISIBLE);
mPreviewText.setText(previewText);
mListView.setSelection(selection);
} else {
mPreviewText.setVisibility(View.GONE);
}
}
});
```
###Changelog
**Version 1.1.0**
添加属性 indexBarSizes,用于设置索引条左右两侧与字母的间距