- 1、本文档共5页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
BottomSheet底部动作条使用
BottomSheet底部动作条使用
底部动作条
底部动作条(Bottom Sheets)是一个从屏幕底部边缘向上滑出的一个面板,使用这种方式向用户呈现一组功能。底部动作条呈现了简单、清晰、无需额外解释的一组操作。
使用环境
底部动作条(Bottom Sheets)特别适合有三个或者三个以上的操作需要提供给用户选择、并且不需要对操作有额外解释的情景。如果只有两个或者更少的操作,或者需要详加描述的,可以考虑使用菜单(Menu)或者对话框替代。
底部动作条(Bottom Sheets)可以是列表样式的也可以是宫格样式的。宫格布局可以增加视觉的清晰度。
你可以使用底部动作条(Bottom Sheets)展示和其 app 相关的操作,比如做为进入其他 app 的入口(通过 app 的 icon 进入)。
我们来看看官方展示的效果:
行为
显示底部动作条的时候,动画应该从屏幕底部边缘向上展开。根据上一步的内容,向用户展示用户上一步的操作之后能够继续操作的内容,并提供模态[1]的选择。点击其他区域会使得底部动作条伴随下滑的动画关闭掉。如果这个窗口包含的操作超出了默认的显示区域,这个窗口需要可以滑动。滑动操作应当向上拉起这个动作条的内容,甚至可以覆盖整个屏幕。当窗口覆盖整个屏幕的时候,需要在上部的标题栏左侧增加一个收起按钮。
添加依赖:
compile com.android.support:design:24.2.0
BottomSheet使用例子:
[html] view plain copy print?在CODE上查看代码片派生到我的代码片
?xml version=1.0 encoding=utf-8?
android.support.design.widget.CoordinatorLayout xmlns:android=/apk/res/android
xmlns:app=/apk/res-auto
android:layout_width=match_parent
android:layout_height=match_parent
Button
android:layout_width=match_parent
android:layout_height=80dp
android:onClick=click
android:text=BottomSheet /
android.support.v4.widget.NestedScrollView
android:id=@+id/bottom_sheet
android:layout_width=match_parent
android:layout_height=wrap_content
app:layout_behavior=@string/bottom_sheet_behavior
LinearLayout
android:layout_width=match_parent
android:layout_height=300dp
android:gravity=center
android:orientation=vertical
TextView
android:layout_width=match_parent
android:layout_height=wrap_content
android:minHeight=50dp
android:gravity=center_vertical
android:drawableLeft=@mipmap/ic_launcher
android:text=BottomSheet布局 /
TextView
android:layout_width=match_parent
android:layout_height=wrap_content
android:gravity=c
文档评论(0)