鸿蒙开源组件——侧滑显示控件
jacksky
发布于 2021-8-11 11:12
浏览
0收藏
MaterialDrawer
项目介绍
- 项目名称:MaterialDrawer
- 所属系列:openharmony的第三方组件适配移植
- 功能:MaterialDrawer是一个多功能的侧拉抽屉第三方库
- 项目移植状态:侧滑无法实现更新文本,无法设置侧滑的高度,目前支持通过xml设置侧滑控件,通过代码设置侧滑无法实现改功能
- 调用差异:添加Header头信息、列表文件是通过初始化PrimaryDrawerItem对象添加进代码中
- 开发版本:sdk6,DevEco Studio 2.2 Beta1
- 基线版本:Release v8.4.1
效果演示
安装教程
1.在项目根目录下的build.gradle文件中,
allprojects {
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
}
}
}
2.在entry模块的build.gradle文件中,
在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
使用说明
-add XML
<com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView
ohos:id="$+id:slide"
ohos:height="match_parent"
ohos:width="match_content"
ohos:orientation="horizontal"
ohos:visibility="hide">
<DependentLayout
ohos:height="match_parent"
ohos:width="100vp"
ohos:alignment="center"
ohos:orientation="vertical"
ohos:top_margin="30vp">
</DependentLayout>
</com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView>
-Add items and adding some functionality
MaterialDrawerSliderView.addItems(this).addProfileDrawerItem(new ProfileDrawerItem(this.getResourceManager(),
"Mike Penz", "mikepenz@gmail.com", ResourceTable.Media_profile, ResourceTable.Media_bamboo)).addProfileDrawerItem(new ProfileDrawerItem(this.getResourceManager(),
"Demo User", "demo@github.com", ResourceTable.Media_profile2, ResourceTable.Media_mat2)).addProfileDrawerItem(new ProfileDrawerItem(this.getResourceManager(),
"Max Muster", "max.mustermann@gmail.com", ResourceTable.Media_profile2, ResourceTable.Media_mat2)).addProfileDrawerItem(new ProfileDrawerItem(this.getResourceManager(),
"Felix House", "felix.house@gmail.com", ResourceTable.Media_profile2, ResourceTable.Media_mat2)).addProfileDrawerItem(new ProfileDrawerItem(this.getResourceManager(),
"Mr. X", "mister.x.super@gmail.com", ResourceTable.Media_profile2, ResourceTable.Media_mat2)).addProfileDrawerItem(new ProfileDrawerItem(this.getResourceManager(),
"Batman", "batman@gmail.com", ResourceTable.Media_profile2, ResourceTable.Media_mat2)).addProfileDrawerItemSection(PrimaryDrawerItem("Add Account",
ResourceTable.Media_ic_settings_black_24dp, "Add new GitHub Account", new withOnDrawerItemClickListener() {
@Override
public void onClick(DrawerItem section) {
num++;
ProfileDrawerItem account6 = new ProfileDrawerItem(AdvancedDrawerAbility.this.getResourceManager(),
"Batman"+num, "Batman"+num,"batman"+num+"@gmail.com", ResourceTable.Media_profile2, ResourceTable.Media_mat2);
AdvancedDrawerAbility.this.addProfileDrawerItem(account6);
AdvancedDrawerAbility.this.addProfileDrawerItemList();
}
})).addProfileDrawerItemSection(PrimaryDrawerItem("Manage Account",
ResourceTable.Media_ic_settings_black_24dp, new withOnDrawerItemClickListener() {
@Override
public void onClick(DrawerItem section) {
}
})).addProfileDrawerItemList();
-Selecting an item
.setDoneIconResource(ResourceTable.Graphic_dark_blue_background).select()
测试信息
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件有差异
版本迭代
- 0.0.1-SNAPSHOT
版权和许可信息
Copyright 2021 Mike Penz
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MaterialDrawer-demo_2448.zip 3.68M 48次下载
已于2021-8-11 11:12:01修改
赞
收藏
回复
相关推荐
有时候滑动时候,会卡在一半一半