AsymmetricGridView 本项目基于开源项目 AsymmetricGridView 进行 openharmony 移植和开发,可以通过项目标签以及github地址( https://github.com/felipecsl/AsymmetricGridView )追踪到原安卓项目版本 项目介绍 - 项目名称:AsymmetricGridView_Harmony - 所属系列:openharmony 第三方组件适配移植 - 功能:非对称网格视图 - 基线版本:master - 项目移植状态:主功能完成 - 调用差异:AsymmetricGridView特性未实现 - 开发版本:sdk5,DevEco Studio2.1 beta3 - 项目作者和维护人:pengchengfu - 联系方式:pengchengfu072@chinasoftinc.com 效果演示     #### 安装教程 在moudle级别下的build.gradle文件中添加依赖 ``` // 添加maven仓库 repositories { maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } } // 添加依赖库 dependencies { implementation 'com.gitee.chinasoft_ohos:AsymmetricGridview:0.0.1-SNAPSHOT' } ``` 在sdk5,DevEco Studio2.1 beta3下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 使用说明 In your layout xml: <com.felipecsl.lib.AsymmetricRecyclerView xmlns:ohos="http://schemas.huawei.com/res/ohos" ohos:id="$+id:recyclerView" ohos:height="match_parent" ohos:width="match_parent"/> In your activity class: @Override public void onStart(Intent intent) { super.onStart(intent); super.setUIContent(ResourceTable.Layout_ability_main); AsymmetricRecyclerView recyclerView = (AsymmetricRecyclerView) findComponentById(ResourceTable.Id_recyclerView); RecyclerViewAdapter adapter = new RecyclerViewAdapter(demoUtils.moarItems(50)); recyclerView.setRequestedColumnCount(3); recyclerView.setDebugging(true); recyclerView.setRequestedHorizontalSpacing(Utils.vpToPx(this, 3)); recyclerView.setItemProvider(new AsymmetricRecyclerViewAdapter<>(this, recyclerView, adapter)); } Whenever your adapter changes (add or remove items), the grid will automatically reflect those changes by subscribing to your adapter changes. Toggle to enable/disable reordering of elements to better fill the grid // Setting to true will move items up and down to better use the space // Defaults to false. listView.setAllowReordering(true); listView.isAllowReordering(); // true 测试信息 CodeCheck代码测试无异常 CloudTest代码测试无异常 火绒安全病毒安全检测通过 当前版本demo功能与安卓原组件基本无差异 测试员:黄锡平 版本迭代 - 0.0.1-SNAPSHOT 版权和许可信息 Code and documentation copyright 2011-2015 Felipe Lima. Code released under the [MIT license](LICENSE.txt).