bottom-sheet 相关问题

材料设计理念 - 底部工作表从屏幕底部向上滑动以显示更多内容。

FlatList 无法在 Android 上的 BottomSheet 中工作

我正在使用 gorhom/react-native-bottom-sheet 我面临的问题: 我在 BottomSheet 中有一个 FlatList,我可以在 ios 上滚动 FlaLlist,但它在 android 上不起作用。

回答 4 投票 0

BottomSheetScaffold 展开时不会粘在 BottomNavigation 的顶部

我正在尝试使用BottomSheetScaffold,但出于某种奇怪的原因,当我在带有底部导航的屏幕上使用它并展开bottomSheet时,它的底部移动了一点到顶部,但是...

回答 1 投票 0

为什么BottomSheetDialog主题展开后不起作用?

当 BottomSheetDialog 处于展开状态时,我的主题资源不起作用? @覆盖 受保护无效 onStart() { super.onStart(); 行为.setState(BottomSheetBehavior.STATE_EXPANDED); } 当

回答 1 投票 0

是否可以使底部工作表从顶部而不是底部出现在颤振中?

我想从顶部而不是底部点击浮动操作按钮来打开底部工作表。有什么办法可以做到这一点吗?或者是否有任何其他小部件可以用于我的目的而不是

回答 1 投票 0

底部表单内的RecyclerView 不起作用

以下是我的xml 主视图 以下是我的xml 主视图 <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- Your content --> <include layout="@layout/content_main"/> <!-- Bottom Sheet --> <include layout="@layout/main_bottom_sheet"/> </android.support.design.widget.CoordinatorLayout> 底表视图 <?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_navigation_sheet" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFFFF" android:orientation="vertical" app:behavior_peekHeight="56dp" app:layout_behavior="@string/bottom_sheet_behavior"> <FrameLayout android:id="@+id/fragment_bottom_container" android:layout_width="match_parent" android:layout_height="match_parent"/> </LinearLayout> 回收视图屏幕 <?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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/toolbar_height" android:background="@color/alabaster" android:elevation="@dimen/elevation_normal" android:orientation="horizontal" tools:targetApi="lollipop"> <FrameLayout android:id="@+id/search_as_you_type_back_button" android:layout_width="@dimen/toolbar_height" android:layout_height="@dimen/toolbar_height" android:foreground="?selectableItemBackground"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:contentDescription="@string/accessibility_back" app:srcCompat="@drawable/ic_arrow_back"/> </FrameLayout> <EditText android:id="@+id/search_as_you_type_edit_text" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginStart="@dimen/margin_medium" android:layout_weight="1" android:background="@color/transparent" android:focusable="true" android:focusableInTouchMode="true" android:gravity="center_vertical" android:imeOptions="actionSearch" android:inputType="text" android:textColor="@color/darkest_grey" android:textSize="@dimen/text_medium" tools:text="Chocolate"/> <FrameLayout android:id="@+id/search_as_you_type_close_container" android:layout_width="?attr/actionBarSize" android:layout_height="?attr/actionBarSize" android:foreground="?selectableItemBackground" android:visibility="invisible"> <ImageView android:id="@+id/search_as_you_type_close" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:contentDescription="@string/accessibility_close" app:srcCompat="@drawable/ic_cancel_grey_24dp"/> </FrameLayout> </LinearLayout> <ViewFlipper android:id="@+id/view_flipper" android:layout_width="match_parent" android:layout_height="match_parent" android:inAnimation="@android:anim/fade_in" android:outAnimation="@android:anim/fade_out"> <android.support.v7.widget.RecyclerView android:id="@+id/auto_suggest_list" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:nestedScrollingEnabled="true"/> </ViewFlipper> </LinearLayout> 片段底部容器布局将使用具有 recyclerview 屏幕的片段进行膨胀。这里的 Recyclerview 在填充数据后不会滚动。当键盘弹出时它也不会被调整。我尝试设置 windowssoftInputMode。有人可以帮忙解决这个问题吗 这是 BottomSheet 中 RecyclerView 的工作代码 XML: <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"> <androidx.coordinatorlayout.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerViewMore" android:layout_width="match_parent" android:layout_height="match_parent" android:focusableInTouchMode="true" android:orientation="vertical" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> </RelativeLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout> </layout> 在 Java 中 onCreateView B.recyclerViewMore.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { v.getParent().requestDisallowInterceptTouchEvent(true); v.onTouchEvent(event); return true; } }); lincy 的解决方案对我不起作用。这些事件从未进行到OnTouchListener。 我的解决方案是使用挂钩到 RecyclerView 的自定义布局来包装 dispatchTouchEvent: <info.mschmitt.view.TouchEventInterceptorLayout android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> </info.mschmitt.view.TouchEventInterceptorLayout> TouchEventInterceptorLayout的代码(已删除构造函数): public class TouchEventInterceptorLayout extends FrameLayout { @Override public boolean dispatchTouchEvent(MotionEvent ev) { boolean handled = super.dispatchTouchEvent(ev); requestDisallowInterceptTouchEvent(true); return handled; } } 这将递归地禁用当前触摸交互的所有父级中的触摸事件处理,仅留下 RecyclerView 作为处理目标。 我不知道为什么这一切都是必要的。也许这是 Google 的 BottomSheet 实现中的一个错误。 rv.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { v.getParent().requestDisallowInterceptTouchEvent(true); v.onTouchEvent(event); return true; } }); 这是@Matt 解决方案的优化,因为它不适用于我的案例。 class TouchEventInterceptorLayout(context: Context, attrs: AttributeSet?) : FrameLayout(context, attrs) { override fun dispatchTouchEvent(ev: MotionEvent): Boolean { val handled = super.dispatchTouchEvent(ev) requestDisallowInterceptTouchEvent(true) return handled }} 并像这样包装recyclerview <com.demo.view.TouchEventInterceptorLayout android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.recyclerview.widget.RecyclerView android:layout_width="match_parent" android:layout_height="match_parent"/> </com.demo.view.TouchEventInterceptorLayout> 当用户滚动列表时,您需要阻止对父级(BottomSheet)的触摸事件。试试这个代码。 recyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() { @Override public boolean onInterceptTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) { rv.getParent().requestDisallowInterceptTouchEvent(true); return false; } @Override public void onTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) { } @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { } });

回答 5 投票 0

尺寸适合 SwiftUI 底板高度问题

我想制作尺寸适合的 SwiftUI 底板 结构ContentView:视图{ @State var PresentSheet:Bool = false var body: 一些视图 { 按钮(“点击我”){

回答 1 投票 0

Android ViewPager 与 RecyclerView 在 BottomSheet 中工作不正确

当我尝试滚动列表时,有时这工作不正确 - BottomSheet 拦截滚动事件并隐藏。 如何重现这个: 打开底页 更改ViewPager的页面 尝试滚动 l...

回答 11 投票 0

当我尝试将状态设置为 STATE_SETTLING 时,为什么 BottomSheetBehavior 会抛出 java.lang.IllegalArgumentException: Illegal state argument: 2

我有一个方法对地图单击采取行动,当我单击地图时,方法尝试将状态设置为 STATE_SETTLING 但它抛出 IllegalArgumentException 我已经检查过状态是否...

回答 1 投票 0

Android Compose:通过拖动或后按关闭底部工作表时屏幕冻结

我正在使用 Jetpack Compose 开发 Android 应用程序,并且遇到了一个问题:当我与底部工作表交互时(向下拖动它或使用后退按钮将其关闭),我的屏幕变成

回答 1 投票 0

iOS 16.4,SwiftUI 底部工作表有时会忽略presentationDetents

从 SwiftUI 中的 iOS 16.4 开始,我们可以使用 .sheet 修饰符和 .presentationDetents 来指定底部工作表的高度。我们可以进一步使用 .presentationBackgroundInteraction 来允许交互...

回答 1 投票 0

如何在 swiftUI 中的选项卡栏上方实现底部工作表?

我正在开发一个 iOS 应用程序,我想实现一个显示在 TabBar 上方的底部工作表。 我想要得到附件中的外观。 在此输入图像描述 我很欣赏...

回答 1 投票 0

底页对话框横向宽度问题

bottom_sheet_image_dialog.xml: bottom_sheet_image_dialog.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:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" app:behavior_hideable="false" app:behavior_peekHeight="62dp" app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/llAddDriverPic" android:background="?android:attr/selectableItemBackground" android:padding="8dp"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@drawable/baseline_add_photo_alternate_24" android:layout_margin="8dp"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/add_picture" android:layout_gravity="center_vertical" android:padding="8dp"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/llRemoveDriverPic" android:background="?android:attr/selectableItemBackground" android:padding="8dp"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@drawable/baseline_no_photography_24" android:layout_margin="8dp"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/remove_picture" android:layout_gravity="center_vertical" android:padding="8dp"/> </LinearLayout> 代码实现: BottomSheetDialog bsDialog = new BottomSheetDialog(getContext()); bsDialog.setContentView(R.layout.bottom_sheet_image_dialog); bsDialog.setOnShowListener(dialog -> { BottomSheetBehavior bottomSheetBehavior = ((BottomSheetDialog)dialog).getBehavior(); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); }); 发生以下问题:视频中看到的宽度不会完全显示。 如果我在横向模式下从一开始就启动底页,宽度看起来也会不同,因为左侧和右侧没有被覆盖: 问题可能是什么? 显示对话框之前是否需要预先定义宽度? -> 你的xml布局没有问题,可以用代码解决。我在下面提供了一个解决此问题的示例。 => 底表类代码 public class BottomSheet extends BottomSheetDialogFragment { private View view; private BottomSheetBehavior mBottomBehavior; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.bottom_sheet_layout, container, false); //Do your logic code here return view; } @Override public void onStart() { super.onStart(); mBottomBehavior = BottomSheetBehavior.from((View) view.getParent()); mBottomBehavior.setMaxWidth(ViewGroup.LayoutParams.MATCH_PARENT); mBottomBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); } } => 活动类别代码 Button button = findViewById(R.id.button); button.setOnClickListener(v -> { //To open the bottom sheet, NB. make sure 'BottomSheet' is the name you declared Bottom sheet class BottomSheet bottomSheet = new BottomSheet(); bottomSheet.show(getSupportFragmentManager(), "exampleBottomSheet"); }); 在科特林中: val dialog = BottomSheetDialog(context).apply { setContentView(bottomSheet.root) behavior.maxWidth = ViewGroup.LayoutParams.MATCH_PARENT behavior.state = BottomSheetBehavior.STATE_EXPANDED }

回答 2 投票 0

处理手势时抛出以下断言:未找到 Scaffold 小部件

我正在尝试在 ElevatedButton 上 onPressed 之后实现 showBottomSheet,但出现以下错误 ======== 手势捕获异常======================================== =============...

回答 2 投票 0

使用 @gorhom/bottom-sheet 时 ReactNative 应用程序崩溃

我们有一个 Nx monorepo 工作区,其中包含 React Web 应用程序和 ReactNative 移动应用程序设置。 我们正在尝试使用@gorhom/bottom-sheet,但是一旦我们呈现bottomsheet,移动应用程序就会崩溃......

回答 1 投票 0

单击底页上的关闭按钮可将其隐藏在撰写中

我有以下可组合的底页。 我希望能够通过拖动、单击背景并单击关闭按钮来关闭底页。 @可组合 有趣的 CDSModelBottomSheet(

回答 1 投票 0

Android compose ModalBottomSheetLayout 导致巨大的重组计数

我现在正在使用 compose 工作几个星期,我认为有些事情仍然相当具有挑战性或很奇怪。 我的最新功能需要一个 BottomSheet,准确地说是一个 ModalBottomSheet。 检查时...

回答 1 投票 0

Flutter状态,根据底部导航栏item的索引更新内容

我正在构建一个颤振应用程序,在某些时候,我必须添加一个底部工作表,所以我使用了“showModalBottomSheet”。我还想在其中显示一个导航栏,所以我添加了一个

回答 1 投票 0

flutter:bottomSheet 可拖动且具有动画效果

我正在开发一个应用程序,当用户单击按钮以显示更多信息时,我想显示底部工作表,如下例所示 这是一个例子:https://i.ibb.co/7bjgNRg/

回答 1 投票 0

如何限制在点击外部时关闭 showModalBottomSheet?

我有两个页面,正在使用 showModalBottomSheet 导航到第二个页面。在第二页上,我使用了 DraggableScrollableSheet。当文本表单字段为空时,我必须限制底部工作表

回答 2 投票 0

关闭 BottomSheet Flutter 时如何将数据保留在其中?

我对 Flutter(和编程)非常陌生。 我有一个 BottomSheet,其中包含 ChoiceChips 和一些开关。一切都很好,但是当我关闭 BottomSheet 时,它不会保存开关的状态...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.