Coder Social home page Coder Social logo

categoryview's Introduction

安卓目录View,双列展示。

Android category view, displayed as two list.

特点 Feature:

  1. 可配置性高,条目样式可以通过multi type的方式拓展,分块间距可以通过decoration来设置,感谢 BRVAH~
  2. 滚动时自动同步两列的位置;
  3. 反向滚动完全支持,此时前一列表会从最后一项开始显示;
  4. 泛型支持,设置时更易获取数据;
  5. 使用方便~

  1. Highly configurable, the item style and section margin can be extended by multi type and decoration, supported by BRVAH,thanks to them~

  2. Auto sync position in two list when scrolling;

  3. Backward scroll is fully supported, previous list is displayed from the last one;

  4. Generic support, easy to get your data when configuring;

  5. Very easy to use~


示例截图 Demo capture:

see the demo folder

示例视频 Demo video: 点击查看 Click to see video

使用方式 Way to use:

<com.sky.categorybrowser.CategoryBrowserView
android:id="@+id/category_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:mainWidth="100dp"
/>
private void setupCategory() {
    //1. 初始化一个CategoryBrowserView。 Setup the category view
    CategoryBrowserView<CategoryBean.MainCategory, CategoryBean.LevelonesBean, CategoryItem> categoryBrowserView = findViewById(R.id.category_view);
    //2. 加载数据,转换成所需类型。 Load and convert your data to the structure required
    CategoryBean category = Repository.getSampleCategory();
    List<Category<CategoryBean.MainCategory, CategoryBean.LevelonesBean, CategoryItem>> categoryList = DemoCategoryViewConfiger.convertToCategory(category.getMainCategoryList());
    //3. 定义一个view configer, 设置数据展示及点击逻辑。  Define a view configer to define how to setup the category view  with your data
    CategoryViewConfiger<CategoryBean.MainCategory, CategoryBean.LevelonesBean, CategoryItem> configer = new DemoCategoryViewConfiger(MainActivity.this){
        .....
    };
    //4. 将view configer设置给初始化一个CategoryBrowserView,要先设置configer。Set the configer and data to the category view. Configer must be set before the data
    categoryBrowserView.setViewConfiger(configer);
    categoryBrowserView.setCategoryList(categoryList,0);
    }

License

MIT License

Copyright (c) 2019 rpsky

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.

categoryview's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.