ghi*_*ita 0 android scroll kotlin android-recyclerview android-constraintlayout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/bottomSheetLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_top_round_corner">
<androidx.cardview.widget.CardView
android:id="@+id/cardViewInnerProductContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
app:cardElevation="10dp"
app:cardCornerRadius="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/closeIv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_close_dark"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/changeAddressTitleTv"
style="@style/FontLocalizedBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="7dp"
android:paddingStart="12dp"
android:text="@string/changeaddress_popup_change_address"
android:textColor="@color/colorTextPrimary"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/closeIv" />
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/colorDividerLight"
app:layout_constraintTop_toBottomOf="@id/closeIv" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/locationRv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider"
tools:listitem="@layout/item_choose_address" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/addressesRv"
android:layout_width="match_parent"
android:layout_height="200dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:paddingBottom="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/locationRv"
tools:listitem="@layout/item_choose_address" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
val addressesLayoutManager = LinearLayoutManager(context)
addressesLayoutManager.orientation = RecyclerView.VERTICAL
addressesRv.layoutManager = addressesLayoutManager
Run Code Online (Sandbox Code Playgroud)
addressesRvrecycleView 不滚动。我在底部对话框中设置了这个。它只是采用 200dp 高度尺寸并仅显示适合的项目,并且我无法滚动浏览所有项目。
我尝试取出CardView,删除视图中的其他回收,将其包装addressesRv在 NestedScrollLayout 内,但滚动的任何一种情况都不起作用。
编辑:
如果放置了NestedScrollview,请将其删除。
并将其添加到您的地址Rv recyclerview中
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1766 次 |
| 最近记录: |