alb*_*ert 3 android android-recyclerview android-coordinatorlayout bottom-sheet
我有一个带有BottomSheet的CoordinatorLayout。如果Bottomsheet 只有一个RecyclerView,则一切正常。我试图在 RecyclerView 顶部添加一些 Textview 和按钮,但是当它到达顶部高度时,recyclerview 会在另一个视图下方滚动。我希望其他视图也滚动。如果BottomSheet 只包含其他视图(没有Recyclerview)也可以正常工作。当我结合 RecyclerView 和其他视图元素(按钮、TextView)时,滚动不符合预期。
我想将 Recyclerview 上方的视图设置为列表的第一项,但这增加了适配器的复杂性。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:behavior_hideable="false"
app:behavior_peekHeight="80dp"
app:layout_behavior="@string/bottom_sheet_behavior">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Text 2"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Text 3"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:background="@android:color/white"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="true"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5611 次 |
| 最近记录: |