- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在尝试设置 Bottomsheet
Google 在他们的应用程序(例如 GOOGLE NEWS 等)中使用的方式,
This is how Google's
Bottomsheet
looks like the following
Where my
Bottomsheet
looks like the following
马上你会注意到两件事,
我的 bottomsheet
代码如下(为了简单起见,我删除了控件)
MyBottomSheet.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottom_sheet"
android:elevation="10dp"
android:minHeight="300dp"
app:behavior_peekHeight="120dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginBottom="30dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--controls here-->
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
我在我的代码中调用它如下
View view = LayoutInflater.Inflate(Resource.Layout.MyBottomSheet, null);
Dialog dialog = new BottomSheetDialog(this);
dialog.SetContentView(view);
如何获得圆角并确保底部导航不透明?
最佳答案
要获得 Google 的模态 BottomSheet 设计,请按以下方式实现它。首先创建一个形状可绘制对象,它将用作底部工作表的背景:
bg_bottomsheet.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="@dimen/bottom_sheet_corner_radius"
android:topRightRadius="@dimen/bottom_sheet_corner_radius" />
<padding android:top="@dimen/bottom_sheet_top_padding" />
<solid android:color="@color/white" />
现在为 BottomSheet 小部件创建自定义样式。
style-v21.xml
<resources>
<style name="BottomSheetDialogTheme" parent="BaseBottomSheetDialog">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/white</item>
</style>
</resources>
styles.xml
<resources>
<style name="BottomSheet" parent="@style/Widget.Design.BottomSheet.Modal">
<item name="android:background">@drawable/bg_bottom_sheet_dialog_fragment</item>
</style>
<style name="BaseBottomSheetDialog" parent="@style/Theme.Design.Light.BottomSheetDialog">
<item name="android:windowIsFloating">false</item>
<item name="bottomSheetStyle">@style/BottomSheet</item>
</style>
<style name="BottomSheetDialogTheme" parent="BaseBottomSheetDialog" />
</resources>
现在,扩展 BottomSheetDialogFragment
并在其上设置新主题。就是这样!
关于android - BottomSheet - 不正确的设计行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50619217/
我有基于角度 Material 文档的以下代码: 在我的 HTML Abrir BottomSheet 并且,在我的页面 ts 存档中: import { Component, OnInit } f
我想要一些关于如何修改这段代码的帮助,这样我就可以用触摸手势上下滑动这个反应本机底片。我想出了怎么用纽扣来做。在我的Package.json中,我使用了@Gorhom/Bottom-Sheet,“re
我正在为我的一种布局使用 BottomSheet View 。对于一个非常具体的情况,我需要 BottomSheet 的动画持续时间,它通过 setState(...) 方法在布局中滑动。它应该在 4
FAB BottomSheet按下后出现在屏幕上,但是位置不对(见图1),我想做成图2的样子,怎么解决? 我的 Activity : public class FirstscreenActivity
我有一个包含产品详细信息卡片的 BottomSheet。问题是,当我在 Bottom Sheet 处于 展开 状态时单击产品详细信息上的 + 或 - 按钮时,它跳下来。 当它处于关闭状态并且我单击按钮
我正在尝试在我的应用程序中实现 BottomSheet。我正在学习安卓。我已经按照图书馆页面 here 中给出的说明实现了它.我使用了如下的 Java 代码。 findViewById(R.id.bu
我是 Android 的新手 BottomSheet并且我已经成功地尝试了有关如何使用它的示例,但大多数示例仅演示了通过查看点击事件显示/隐藏 BottomSheet。 现在我有以下代码: Botto
我正在使用 bottomsheetlayout 弹出窗口进行社交媒体共享。现在的问题是,它不止一次开放。请帮我解决这个问题。 在我的按钮上单击我调用 asynctask 以下载图像。 @Overrid
我试图不让 BottomSheet 填充整个屏幕,而是在展开时在上方留出一些空间。这是我的 onExpand 填充整个屏幕的代码。 bottomSheetBehavior = BottomSheetB
我有一个 FrameLayout (teaserContainer) 和 BottomSheet (invitesContainer)。 FrameLayout 位于 BottomSheet 之外(和
我一直在尝试设置 Bottomsheet Google 在他们的应用程序(例如 GOOGLE NEWS 等)中使用的方式, This is how Google's Bottomsheet looks
我正在尝试在 Android 中实现类似于下图的摘要 Bottom Sheet 库。有没有什么方法可以将多个 Bottom Sheet 附加到一个 View ,您可以向左/向右滑动以切换并让相邻的 V
目前我正在使用来自 this lib 的底页,我想实现这样的图片动画google map在滑动 bottomsheet 时,我想按照显示的图像一起滑动 imageview,我已经用过这个link fo
我有一个 Bottom Sheet ,里面有一个 NestedScrollView(见下文)。当我按下 FAB 按钮时,我想让这个 NestedScrollView 中的某些部分不可见。但是,当我将一
我正在尝试在布局中使用 BottomSheet。 Root View 是一个 CoordinatorLayout,我想在 Bottom Sheet 的顶部设置 Elevation,所以我将它设置为高值
编辑: package com.walkindeep.teammanagerpreview; import android.content.Context; import android.os.Bun
我遇到 BottomSheetBehaviour 的问题。BottomSheet 在开始时没有扩展到最大高度。但是,它可以滚动到最大高度。但我不想滚动,而是希望 BottomSheet 扩展到其最大高
所以我在 CoordinatorLayout 中使用嵌套子滚动的新支持库行为,我有这样的 View : 我的应用程序有一个要求,这不是新要求,我需要暂时禁用协调器布局的某些元素的滚动。对于这个 b
我已经使用 NestedScrollView 实现了 Bottom Sheet 行为。并且想知道是否可以在外部触摸时隐藏底部 View 。 最佳答案 我终于可以做到了, 使用了以下代码行: @Over
我知道可以像这样设置普通的底板 rememberModalBottomSheetState( initialValue = ModalBottomSheetValue.Hidden, conf
我是一名优秀的程序员,十分优秀!