contentView
.
post
(
(
)
-
>
{
BottomSheetBehavior behavior
=
BottomSheetBehavior
.
from
(
findViewById
(
R
.
id
.
design_bottom_sheet
)
)
;
behavior
.
setHideable
(
false
)
;
}
)
;
BottomSheetDialog禁止滑动关闭但允许点击背景关闭问题解决方案问题BottomSheetDialog是一个很好用的官方底部弹出层,但是不能够直接设置禁止滑动关闭但允许点击背景关闭,解决起来很麻烦,这里有个简单的方案(分析源码所得)解决方案 contentView.post(() -> { //contentView是自定义的显示在BottomSheet...
Bott
omSheet
Dialog
Fragment是位于com.google.
android
.material包下的一个类.
Bott
omSheet
Dialog
Fragment 继承自AppCompat
Dialog
Fragment
AppCompat
Dialog
Fragment继承自
Dialog
Fragment
因为AppCompat
Dialog
Fragment 是一个特殊版本的
Dialog
Fragment, 所以其实可以看做
Bott
omSheet
Dialog
Fragment是直接继承于
Dialog
Fr
public class
Bott
omSheet
Fragment extends
Bott
omSheet
Dialog
Fragment {
private Button button;
private View ...
> 作者:林冠宏 / 指尖下的幽灵
> 掘金:https://juejin.im/user/587f0dfe128fe100570ce2d8
> 博客:http://www.cnblogs.com/linguanh/
> GitHub : https://github.com/af913337456/
> 腾讯云专栏: https://cloud.tencent.com/developer/user/1148436/activities
首先是--
Android
SDK 自带的
Bott
omSheet
Dialog
下面的 gif 图是一个
Android
SDK 自带的
Bott
omSheet
Dialog
内部加了 RecyclerView 列表控件的效果
可以看出:
下
滑动
作会收起,隐藏掉
dialog
上滑会完全展开
展开后,才能
滑动
RecyclerView 内部
如果你内部使用的是 ListView 列表控件,你会发现会有其他奇怪的情况。
然后是--网易云音乐 的
Bott
omSheet
Dialog
下面的 gif 图是一个
Android
版 网易云音乐的B
最近又遇到一个小小问题,
Bott
omSheet
Dialog
弹窗总是会
滑动
,从网上找了一大片解决办法都是解决
禁止
下滑
关闭
的问题的,但是还是会有一点点的
滑动
效果,正好这个一点点的
滑动
效果遇到了地图----
Bott
omSheet
Dialog
弹窗内添加了一个地图,地图也可以
滑动
,
Bott
omSheet
Dialog
也可以
滑动
,这可真是爽歪歪。
首先多说一句如何使用
Bott
om
Dialog
//底部弹窗依赖
implementation 'com.github.SmartCyl:
Bott
om
Dialog
:1
通过context获取屏幕的宽和高的方法:
DisplayMetrics dm = new DisplayMetrics();
dm = getApplicationContext().getResources().getDisplayMetrics();
int screenWidth = dm.widthPixels;
int screenHeight = dm.heightPixels;
return new Point(screenWidth ,scree...
<style name="
Bott
omSheet
Dialog
Style" parent="Theme.Design.
Bott
omSheet
Dialog
">
<item name="
android
:windowFrame">@null</item>
<item name="
android
:windowIsFloatin...
layout布局文件:<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:
android
="http://schemas.
android
.com/apk/res/
android
"
android
:orientation="vertical"
android
:layout_width="match_pare
override fun onCreate
Dialog
(savedInstanceState: Bundle?):
Dialog
{
val
dialog
= super.onCreate
Dialog
(savedInstanceState) as
Bott
omSheet
Dialog
bind = DataBindingUtil.inflate(Lay
public BottomSheetBehavior<FrameLayout> getBehavior() {
if (behavior == null) {
// The content hasn't been set, so the behavior doesn't exist yet. Let's create it.
ensureContainerAndBehavior();
return behavior;
[/code]
BottomSheetDialog禁止滑动关闭但允许点击背景关闭
ChestnutCsdn
BottomSheetDialog禁止滑动关闭但允许点击背景关闭
BottomSheetDialog禁止滑动关闭但允许点击背景关闭
黑暗夜色: