代码拉取完成,页面将自动刷新
Android 自定义组合控件实例,顶部通用菜单栏使用kotlin编写,你可以java代码调用也可以使用kotlin调用,自定义化程度高,控件整体分为三部分,左边按钮,中间按钮,右边按钮,分别都可以设置只显示文字还是图片,文字的颜色,字体大小,字体加粗,设置图片,图片大小,按钮距离左右间距,设置控件整体背景颜色和控件高度
<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>
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
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" />
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。