效果:
-
创建筛选器实例
01.
<com.poplar.fancyindexer.ui.FancyIndexer
02.
android:id=
"@+id/bar"
03.
android:layout_width=
"fill_parent"
04.
android:layout_height=
"fill_parent"
05.
poplar:widthOffset=
"15dip"
06.
poplar:minFontSize=
"32"
07.
poplar:maxFontSize=
"60"
08.
poplar:tipFontSize=
"72"
09.
poplar:maxBezierHeight=
"150dip"
10.
poplar:maxBezierWidth=
"180dip"
11.
poplar:additionalTipOffset=
"40dip"
12.
poplar:fontColor=
"#ffa0a0a0"
/>
additionalTipOffset:曲线顶点(当前字符)向右的偏移量
maxBezierHeight:贝塞尔曲线的最大高度,
maxBezierWidth:贝塞尔曲线的最大高度。
各个属性的含义请参考下面这张图:
2. 监听字母的变化
1.
FancyIndexer mFancyIndexer = (FancyIndexer) findViewById(R.id.bar);
01.
mFancyIndexer.setOnTouchLetterChangedListener(
new
OnTouchLetterChangedListener() {
02.
03.
@Override
04.
public
void
onTouchLetterChanged(String letter) {
05.
System.out.println(
"letter: "
+ letter);
06.
07.
08.
}
09.
});