鸿蒙开源组件——桌面阴影效果组件

jacksky
发布于 2021-12-3 17:09
浏览
0收藏

MaterialShadows

项目介绍

  • 项目名称: MaterialShadows
  • 所属系列: openharmony的第三方组件适配移植
  • 功能: 实现阴影效果的组件
  • 项目移植状态: 主功能完成
  • 调用差异:无
  • 开发版本:sdk6,DevEco Studio 2.2 Beta1
  • 基线版本:master分支

项目演示

鸿蒙开源组件——桌面阴影效果组件-鸿蒙开发者社区

安装教程

1.在项目根目录下的build.gradle文件中,

allprojects {
   repositories {
       maven {
           url 'https://s01.oss.sonatype.org/content/repositories/releases/'
       }
   }
}

 

2.在entry模块的build.gradle文件中,

dependencies {
   implementation('com.gitee.chinasoft_ohos:MaterialShadows:1.0.0')
   ......  
}

 

在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下

使用说明

    <com.sdsmdg.harjot.materialshadows.MaterialShadowViewWrapper
        ohos:id="$+id:shadow_wrapper"
        ohos:height="match_content"
        ohos:width="match_parent"
        ohos:background_element="#FFFFFF"
        ohos:padding="20vp"
        app:animateShadow="true"
        app:animationDuration="300"
        app:calculateAsync="true"
        app:shadowOffsetX="10"
        app:shadowOffsetY="10"
        app:showWhenAllReady="true"
        >

        <Image
            ohos:id="$+id:image"
            ohos:height="80vp"
            ohos:width="80vp"
            ohos:align_parent_left="true"
            ohos:image_src="$media:google"
            ohos:padding="10vp"
            ohos:scale_mode="clip_center"/>

    </com.sdsmdg.harjot.materialshadows.MaterialShadowViewWrapper>

 

  • Documentation
XML attribute Java set methods Description Default Value
shadowOffsetX setOffsetX(...) Set the X-offset of the shadow 0.0f
shadowOffsetY setOffsetX(...) Set the Y-offset of the shadow 0.0f
calculateAsync setShouldCalculateAsync(...) Set the flag for async shadow calculations. true
showWhenAllReady setShowShadowsWhenAllReady(...) Set the flag for showing all shadows after all calculations are over true
animateShadow setShouldAnimateShadow(...) Set the flag for shadow animation true
animationDuration setAnimationDuration(...) Set the value of shadow animation duration. 300ms

测试信息

CodeCheck代码测试无异常

CloudTest代码测试无异常

病毒安全检测通过

当前版本demo功能与原组件基本无差异

版本迭代

  • 1.0.0

版权和许可信息

MaterialShadows is licensed under `MIT license`. View license.

 

MaterialShadows-master.zip 456.61K 9次下载
已于2021-12-3 17:09:14修改
1
收藏
回复
举报
1条回复
按时间正序
/
按时间倒序
wx65026c8945df1
wx65026c8945df1

补充一下~如果"app"命名空间爆红,可以添加对app命名空间的说明:

<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayout
    xmlns:ohos="http://schemas.huawei.com/res/ohos"
    xmlns:app="http://schemas.huawei.com/res/app" //在这里添加对app命名空间的说明
    ohos:height="match_parent"
    ohos:width="match_parent"
    ohos:orientation="vertical">

    <com.lijiankun24.shadowlayout.v2.ShadowLayout
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:layout_alignment="center"
        app:shadowColor="#660000"
        app:shadowDx="0"
        app:shadowDy="0"
        app:shadowRadius="50"
        app:shadowSide="0x1111">

        <Image
            ohos:id="$+id:image"
            ohos:height="50vp"
            ohos:width="50vp"
            ohos:layout_alignment="center"
            ohos:background_element="$media:doctor"
            ohos:image_src="$media:icon"
            ohos:scale_mode="zoom_center"/>

    </com.lijiankun24.shadowlayout.v2.ShadowLayout>
</DirectionalLayout>
回复
2024-3-16 22:02:34
回复
    相关推荐