安卓目录View,双列展示。
Android category view, displayed as two list.
- 可配置性高,条目样式可以通过multi type的方式拓展,分块间距可以通过decoration来设置,感谢 BRVAH~
- 滚动时自动同步两列的位置;
- 反向滚动完全支持,此时前一列表会从最后一项开始显示;
- 泛型支持,设置时更易获取数据;
- 使用方便~
-
Highly configurable, the item style and section margin can be extended by multi type and decoration, supported by BRVAH,thanks to them~
-
Auto sync position in two list when scrolling;
-
Backward scroll is fully supported, previous list is displayed from the last one;
-
Generic support, easy to get your data when configuring;
-
Very easy to use~
示例截图 Demo capture:
示例视频 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);
}
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.