6 Star 2 Fork 1

HarmonyOS-TPC / WaveSideBar

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

WaveSideBar

目录

功能介绍

  • 带有波浪效果的索引侧栏

演示

左侧滑动 右侧滑动
自定义索引

集成

添加wavesidebar.har到entry下的libs文件夹内
将项目中的build.gradle文件中dependencies→classpath版本改为对应的版本(即你的IDE新建项目中所用的版本)
entry的build.gradle内添加如下代码
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])

方式二:
allprojects{
    repositories{
        mavenCentral()
    }
}
implementation 'io.openharmony.tpc.thirdlib:WaveSideBar:1.0.3'

布局文件

  <com.gjiazhe.sidebar.WaveSideBar
            ohos:id="$+id:side_bar"
            ohos:width="match_parent"
            ohos:height="match_parent"
            ohos:right_padding="8vp"
            ohos:left_padding="8vp"/>
WaveSideBar sideBar = (WaveSideBar) findComponentById(ResourceTable.Id_side_bar);
        sideBar.setPosition(WaveSideBar.POSITION_LEFT);
        sideBar.setTextColor(Color.BLACK);
        sideBar.setMaxOffset(100);
        sideBar.setPosition(WaveSideBar.POSITION_LEFT);
        sideBar.setTextAlign(WaveSideBar.TEXT_ALIGN_CENTER);
        sideBar.setLazyRespond(true);
        sideBar.setOnSelectIndexItemListener(new WaveSideBar.OnSelectIndexItemListener() {
            @Override
            public void onSelectIndexItem(String index) {
               
            }
        });

自定义属性说明

属性名 说明 默认值
WaveSideBar_sidebar_text_color 侧栏的文字颜色。 Color.BLACK
WaveSideBar_sidebar_lazy_respond 是否懒加载。 false
WaveSideBar_sidebar_text_size 文字尺寸。 14vp
WaveSideBar_sidebar_max_offset 当前选中索引项的偏移量 100vp
WaveSideBar_sidebar_position 侧栏位置 POSITION_RIGHT
WaveSideBar_sidebar_text_alignment 项的对齐方式 TEXT_ALIGN_CENTER

接口说明


 /**
     *自定义侧边栏的文字内容
     *
     * @param indexItems 文字
     */
    public void setIndexItems(String... indexItems) 

  /**
     *设置侧边栏文字颜色
     *
     * @param color 文字颜色
     */
    public void setTextColor(Color color)

 /**
     *侧栏位置
     *
     * @param position 侧栏位置
     */
    public void setPosition(int position)

  /**
     *当前选中索引项的偏移量
     *
     * @param offset 偏移量
     */
    public void setMaxOffset(int offset)

 /**
     *如果为true,则直到手指抬起时,才会调用侦听器。如果false调用时,手指向下,移动和向上
     *
     * @param lazyRespond 是否懒加载
     */
    public void setLazyRespond(boolean lazyRespond)

    /**
     *项的对齐方式
     *
     * @param align 项的对齐方式
     */
    public void setTextAlign(int align)

   /**
     *设置侧边栏文字大小
     *
     * @param size 文字大小
     */
    public void setTextSize(float size)

License

MIT License

Copyright (c) 2016 郭佳哲

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

MIT License Copyright (c) 2016 郭佳哲 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

带有波浪效果的索引侧栏 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/HarmonyOS-tpc/WaveSideBar.git
git@gitee.com:HarmonyOS-tpc/WaveSideBar.git
HarmonyOS-tpc
WaveSideBar
WaveSideBar
master

搜索帮助