נמר*_*כהן 3 android android-layout android-recyclerview android-constraintlayout
我有一个 RecyclerView 有 4 个项目,并clipToPadding设置为 false
我已为两个边距设置了 50dp,并且背景颜色的边距已正确强制执行,但 RecyclerView 的项目超出了 RecyclerView 范围。
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:background="#0F0"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
</android.support.v7.widget.RecyclerView>
Run Code Online (Sandbox Code Playgroud)
黑色背景是父ConstraintLayout,绿色背景是设置给recyclerView的颜色,白色/蓝色项目是ViewHolders。
我在此图像中有一个自定义 LayoutManager,但默认的 LinearLayoutManager 也会出现该错误。
知道可能是什么原因吗?
| 归档时间: |
|
| 查看次数: |
1304 次 |
| 最近记录: |