使用 DialogFragment 和 BottomSheet 实现底部弹出框
来源:互联网 发布:js获取今天年月日 编辑:程序博客网 时间:2024/05/22 22:50
BottomMenuTutorial
项目地址:fccaikai/BottomMenuTutorial
简介:使用 DialogFragment 和 BottomSheet 实现底部弹出框
更多:作者 提 Bug
标签:
DialogFragment-BottomSheet-
ScreenShots
SetUp
Gradle
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects { repositories { ... maven { url 'https://jitpack.io' } }}
Step 2. Add the dependency
dependencies { compile 'com.github.fccaikai:BottomMenuTutorial:1.1.0'}
Maven
Step 1. Add the JitPack repository to your build file
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository></repositories>
Step 2. Add the dependency
<dependency> <groupId>com.github.fccaikai</groupId> <artifactId>BottomMenuTutorial</artifactId> <version>1.0.2</version></dependency>
Usage
Defalut
BottomDialog dialog = BottomDialog.newInstance("title",new String[]{"item1","item2"});/**** BottomDialog dialog = BottomDialog.newInstance("titleText","cancelText",new String[]{"item1","item2"});** use public static BottomDialog newInstance(String titleText,String cancelText, String[] items)* set cancel text*/dialog.show(getChildFragmentManager(),"dialog"); //add item click listener dialog.setListener(new BottomDialog.OnClickListener() { @Override public void click(int position) { Toast.makeText(getContext(), "" + position, Toast.LENGTH_LONG).show(); } });
Custom
custom dialog text size & color if need. in your app corlor.xml
define :
<color name="bottom_lib_dialog_item_text_color">your dialog item color</color> <color name="bottom_lib_dialog_title_text_color">your dialog title color</color> <color name="bottom_lib_dialog_cancel_text_color">your dialog cancel color1</color>
dimen.xml
define:
<dimen name="bottom_lib_dialog_item_text">your dialog item text size,default 16sp</dimen> <dimen name="bottom_lib_dialog_title_text">your dialog title text title,default 18sp</dimen> <dimen name="bottom_lib_dialog_cancel_text">your dialog title cancel title,default 18sp</dimen>
custom dialog padding:
<dimen name="bottom_lib_dialog_padding_top">12dp</dimen> <dimen name="bottom_lib_dialog_padding_bottom">12dp</dimen> <dimen name="bottom_lib_dialog_padding_left">12dp</dimen> <dimen name="bottom_lib_dialog_padding_right">12dp</dimen>
阅读全文
0 0
- 使用 DialogFragment 和 BottomSheet 实现底部弹出框
- 自定义dialogfragment实现底部弹出框效果
- 使用DialogFragment实现弹出框
- 使用DialogFragment实现支付宝支付从底部弹出效果
- Android DialogFragment实现底部弹出菜单效果
- 自定义 DialogFragment 实现底部弹出 dialog
- 使用DialogFragment从底部弹出对话框
- 【Android】底部弹出框BottomSheet…BottomSheetDialog…BottomSheetDialogFragment实验
- DialogFragment从底部弹出
- BottomSheet底部动作条使用
- Android弹出框BottomSheet
- [Android Demo] BottomSheet 底部弹出试图
- 使用DialogFragment实现底部弹窗布局
- android中用DialogFragment实现底部弹框
- Android BottomSheet:底部弹出Fragment面板(4)
- Android屏幕底部弹出DialogFragment(3)
- 底部弹出DialogFragment+与Activity数据交互
- android DialogFragment底部弹出,自定义大小
- UWP开源项目 LLQNotifier 页面间通信利器(移植EventBus)
- C++中的异常处理(三)
- LeetCode[167]Two Sum II
- 三十年河东三十年河西
- TeamViewer不小心注册成商业版试用期到期怎么办
- 使用 DialogFragment 和 BottomSheet 实现底部弹出框
- Spring 报 NoSuchBeanDefinitionException
- 技术文章 | 深入剖析:关于cache buffers chains的经典案例处理详解
- 解决 CPU topology doesn't match maximum vcpu count
- 大化设计模式-单例模式
- n皇后,排列树
- Android录音与播放录音实现
- 黑客术语基础知识
- ASP.NET身份验证方式