
回复
添加资源
添加资源将有机会获得更多曝光,你也可以直接关联已上传资源 去关联
lg\entry\build.gradle 文件中的
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
testImplementation 'junit:junit:4.13'
ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100'
# 下面是导入的组件名 与settings.gradle 名字一样
implementation project(":BottomNavigationF")
}
package com.llt.bottomnavigationf;
import ohos.agp.components.AttrSet;
import ohos.agp.components.Component;
import ohos.agp.components.DirectionalLayout;
import ohos.app.Context;
/**
*键盘alt + insert constructor 实现这里面的方法
*/
public class BottomNavigationBar extends DirectionalLayout {
public BottomNavigationBar(Context context) {
super(context);
}
public BottomNavigationBar(Context context, AttrSet attrSet) {
super(context, attrSet);
}
public BottomNavigationBar(Context context, AttrSet attrSet, String styleName) {
super(context, attrSet, styleName);
}
}
<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:alignment="center"
ohos:orientation="vertical">
<com.llt.bottomnavigationf.BottomNavigationBar
ohos:height="300vp"
ohos:width="match_parent"
ohos:background_element="#c48c48"
>
<Text
ohos:height="match_content"
ohos:width="match_content"
ohos:text_color="#fff"
ohos:text_size="28fp"
ohos:text="Text"
>123123</Text>
</com.llt.bottomnavigationf.BottomNavigationBar>
</DirectionalLayout>
项目地址 有问题可以直接提问 https://gitee.com/blueskyliu/lg.git 或者QQ群953344438