假设我的底部表格有像以下这样的小部件行。如果我想最初仅显示前两行(即前两个LinearLayout),而不显示下面的其他小部件。我不希望最初看到它们。我该如何设置正确的“Peek Height”?硬编码app:behavior_peekHeight可能行不通,因此我需要以编程方式设置它,但如何计算高度呢?
或者是否有更推荐的方法来获得相同的结果?我的意思是,如果我测试Google Maps,长按位置首先仅显示标题部分作为底部表格,但当我尝试向上滚动底部表格时,感觉就好像标题部分(可能不是真正的底部表格)被一个包含所有元素的真正的底部表格所替换。如果我的解释不够清楚,请自行尝试使用Google Maps。
或者是否有更推荐的方法来获得相同的结果?我的意思是,如果我测试Google Maps,长按位置首先仅显示标题部分作为底部表格,但当我尝试向上滚动底部表格时,感觉就好像标题部分(可能不是真正的底部表格)被一个包含所有元素的真正的底部表格所替换。如果我的解释不够清楚,请自行尝试使用Google Maps。
<android.support.v4.widget.NestedScrollView
android:id="@+id/bottom_sheet"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView/>
<android.support.v7.widget.AppCompatSpinner/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView/>
<TextView/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView/>
<TextView/>
</LinearLayout>
<android.support.v7.widget.RecyclerView/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>