android - 对话框按钮 kotlin
问题描述
我以网站https://www.simplifiedcoding.net/bottom-sheet-android/为例
回购这个项目-> https://github.com/probelalkhan/BottomSheet-Tutorial
现在我有问题(见问题) 正如你所见,模态对话框没有完全打开(它可以滚动并展开到全屏),但我需要完全打开对话框。你可以告诉我如何实现它。
我很高兴听到你的回答。
更新
我注意到这个问题发生在平板电脑上。有没有办法解决这个问题?
解决方案
材料设计指南说,底部表应该在底部表上方区域为 19:6 的高度处窥视。由于您的横向屏幕比 16:9 短,因此它会窥视规范中的最小高度。
您可以像这样自定义窥视高度:
<style name="Theme.YourApp" parent="Theme.Design">
<!-- other style configs -->
<item name="bottomSheetDialogTheme">@style/GiveItSomeName</item>
</style>
<style name="GiveItSomeName" parent="Theme.Design.BottomSheetDialog">
<item name="bottomSheetStyle">@style/BottomSheetStyle</item>
</style>
<style name="BottomSheetStyle" parent="Widget.Design.BottomSheet.Modal">
<item name="app:peekHeight">256dp</item><!-- ***** The initial height you want ***** -->
</style>
在 res -> values -> styles 中的 styles.xml 中添加上面的布局
在 bottom_sheet_modal.xml 中进行另一项更改(添加背景)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="match_parent">
<ListView
android:id="@+id/listViewOptions"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
在colors.xml中添加白色
推荐阅读
- sql - 如何缩短这条sql语句?(3 个子查询)
- javascript - (无服务器离线计划错误) TypeError [ERR_INVALID_ARG_TYPE]:“路径”参数必须是字符串类型。接收到的类型对象
- javascript - 如何将此 JS 代码调整到我的 Reactjs 应用程序,以便我可以自定义我的视频播放器?
- r - 如果在多列中找到值,则为布尔值 1/0
- c# - 在 Unity 中反序列化嵌套的 JSON
- firebase - 问:Firestore 安全规则 - 存储在哪里?
- python - 如何将 INSERT INTO ... RETURNING 值分配给变量
- php - 在 PHP Laravel 中的 SQL Server 中将字符串转换为日期数据类型
- python - 满足特定条件后在for循环中返回一项
- sql - 按两列分组,其中一列是时间戳