1 Star 0 Fork 59

chaorenry / IndexBar

forked from droideep / IndexBar 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

IndexBar

安装

添加这个依赖到你的'build.gradle'(available from mavenCentral and jcenter)

compile 'io.github.brightyoyo:indexbar:1.0.0'

描述

仿微信通讯录索引条

微信通讯录截屏

WX

Demo

demo

整合到程序

1) 添加IndexBar到你的布局文件中。

<ListView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<TextView
    android:id="@+id/previewText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:textSize="40sp"
    android:textStyle="bold" />

<com.droideep.indexbar.IndexBar
    android:id="@+id/index_bar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:layout_margin="5dp"
    app:alphabetPadding="5dp"
    app:alphabetTextColor="@color/material_blue_grey_800"
    app:alphabetTextSize="12sp"
    app:indexBarColorNormal="@android:color/transparent"
    app:indexBarColorPressed="#56000000"
    app:indexBarRound="5dp"
    app:withinIndexBar="true" />
  • indexBarColorNormal IndexBar没被点击时的背景色*
  • indexBarColorPressed IndexBar被点击时的背景色*
  • alphabetTextColor IndexBar上每个索引字符的颜色*
  • alphabetTextSize IndexBar上每个索引字符的字符大小*
  • alphabetPadding IndexBar上索引字符的间距*
  • indexBarRound IndexBar圆角的大小*
  • withinIndexBar 是否在IndexBar外也可以索引*

2) 在Activity或Fragment中对IndexBar实例化,注册监听器


	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,用于设置索引条左右两侧与字母的间距

空文件

简介

一个Android自定义控件-----通讯录的索引条 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/chaorenry/IndexBar.git
git@gitee.com:chaorenry/IndexBar.git
chaorenry
IndexBar
IndexBar
master

搜索帮助

14c37bed 8189591 565d56ea 8189591