空祖家的对话框 2.1 菜单底栏也来啦

介绍了空祖家的对话框2.1版本,该版本新增菜单底栏功能,支持自定义列表项和点击回调。适用于Android平台,通过BottomMenu类实现底部菜单展示,支持多种主题和夜间模式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

菜单底栏已加入空祖家的对话框

完整的《空祖家的对话框 2.1》请参阅:https://github.com/kongzue/Dialog 欢迎Star&Fork

相关说明

注意,此处使用的是来自com.kongzue.dialog.v2 的 BottomMenu 类。

List<String> list = new ArrayList<>();
list.add("菜单1");
list.add("菜单2");
list.add("菜单3");
BottomMenu.show(me, list, new OnMenuItemClickListener() {
    @Override
    public void onClick(String text, int index) {
        Toast.makeText(me,"菜单 " + text + " 被点击了",SHOW_TIME_SHORT).show();
    }
},true);
复制代码

包含的参数如下:

字段含义是否必须
activity必须继承自 AppCompatActivity必须
list泛型为 String 的列表必须
OnMenuItemClickListener点击回调可选
isShowCancelButton是否显示“取消”按钮,注意,TYPE_MATERIAL 风格对此无效可选

另外,本菜单暂时对夜间模式(THEME_DARK)不受影响,只提供Light Theme,但不排除接下来的版本对此更新。

使用 iOS 主题时,DialogSettings.ios_normal_button_color 会对菜单内容文字的颜色产生影响,其他主题不受此属性影响。

或可以使用快速调用:

List<String> list = new ArrayList<>();
list.add("菜单1");
list.add("菜单2");
list.add("菜单3");
BottomMenu.show(me, list);
复制代码

使用

Maven仓库:

<dependency>
  <groupId>com.kongzue.dialog</groupId>
  <artifactId>dialog</artifactId>
  <version>2.1.0</version>
  <type>pom</type>
</dependency>
复制代码

Gradle: 在dependencies{}中添加引用:

implementation 'com.kongzue.dialog:dialog:2.1.0'
复制代码

开源协议

   Copyright Kongzue Dialog

   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.
复制代码
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值