1 Star 1 Fork 0

为光 / TopMenuBar

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 2.86 KB
一键复制 编辑 原始数据 按行查看 历史
为光 提交于 2021-05-14 14:02 . update README.md.

TopMenuBar顶部通用菜单栏

介绍

Android 自定义组合控件实例,顶部通用菜单栏使用kotlin编写,你可以java代码调用也可以使用kotlin调用,自定义化程度高,控件整体分为三部分,左边按钮,中间按钮,右边按钮,分别都可以设置只显示文字还是图片,文字的颜色,字体大小,字体加粗,设置图片,图片大小,按钮距离左右间距,设置控件整体背景颜色和控件高度

屏幕截图

属性介绍 attrs.xml

<resources>
    <declare-styleable name="TopMenuBarView">
        <!--整体控件-->
        <!--控件高度-->
        <attr name="topMenuHeight" format="dimension" />
        <!--控件背景-->
        <attr name="topMenuBackground" format="reference|color" />
        <!--左边按钮-->
        <!--按钮类型 image图片 text 文字-->
        <attr name="topMenuLeftType" format="enum">
            <enum name="image" value="0" />
            <enum name="text" value="1" />
        </attr>
        <!--按钮左边距-->
        <attr name="topMenuMarginLeft" format="dimension" />
        <!--按钮图片-->
        <attr name="topMenuLeftImage" format="reference|color" />

        <!--中间按钮-->
        <!--文字大小-->
        <attr name="topMenuCenterTextSize" format="dimension" />
        <!--文字-粗体 normal默认 bold加粗-->
        <attr name="topMenuCenterTextStyle" format="enum">
            <enum name="normal" value="0" />
            <enum name="bold" value="1" />
        </attr>

        <!--右边按钮-->
        <!--按钮类型 image图片 text 文字-->
        <attr name="topMenuRightType" format="enum">
            <enum name="image" value="0" />
            <enum name="text" value="1" />
        </attr>
        <!--按钮右边距-->
        <attr name="topMenuMarginRight" format="dimension" />
        <!--按钮图片-->
        <attr name="topMenuRightImage" format="reference|color" />
    </declare-styleable>
</resources>

使用方法

添加依赖

build.gradle
allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

add的build.gradle

dependencies {
	implementation 'com.gitee.renchunlin:topMenuBar:v1.1'
}

布局中引用

    <com.renchunlin.topmenubarview.TopMenuBarView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
Kotlin
1
https://gitee.com/renchunlin/topMenuBar.git
git@gitee.com:renchunlin/topMenuBar.git
renchunlin
topMenuBar
TopMenuBar
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891