Val*_*tin 5 android android-layout android-design-library bottom-sheet
我正在尝试在我的布局中实现一个持久的底页 - 一个不能完全隐藏,但总是从底部偷看,可以扩展到全高.这是我的布局:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<!-- main content -->
</LinearLayout>
<LinearLayout
android:id="@+id/layoutBottomSheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|bottom"
android:background="@drawable/custom_background"
android:clipToPadding="false"
android:gravity="center_horizontal"
android:orientation="vertical"
app:behavior_hideable="false"
app:behavior_peekHeight="50dp"
app:layout_behavior="@string/bottom_sheet_behavior">
<!-- bottom sheet content -->
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
我期望发生的事情是,一旦我落在屏幕上,底部工作表就会被看到并折叠,但事实并非如此 - 它是隐藏的.我可以得到它通过调用展现出来bottomSheetBehaviour.setState(BottomSheetBehavior.STATE_EXPANDED)在onCreate().奇怪的是,这只会稍微扩大一点 - 超过指定的峰值高度但小于它应占用的全高度.在它出现在这种状态后,我可以将它上下拖动到它应该的位置,它工作正常.问题是屏幕上的初始着陆搞砸了.
我确信有一种方法可以使这个工作,所以底板最初出现在它的窥视高度.有任何想法吗?
| 归档时间: |
|
| 查看次数: |
1180 次 |
| 最近记录: |