I have a recyclerview with a CardView. Even if I dont specify the elevation explicitly, as the items get to the bottom of the screen, the elevation increases. Haven't seen this behavior anywhere else, what can this be caused from?
<android.support.v7.widget.CardView
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:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/card_layout"
app:cardElevation="6dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
android:foreground="?android:attr/selectableItemBackground"
android:fitsSystemWindows="true"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/schedule_card_height"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:id="@+id/schedule_item_category"
style="@style/Base.TextAppearance.AppCompat.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/background_eventlist_category"
android:gravity="center"
android:padding="5dp"
android:textAllCaps="true"
tools:text="Interview"/>
</RelativeLayout>
<View android:layout_height="match_parent"
android:layout_width="1dp"
android:background="@color/colorIcons"
/> …Run Code Online (Sandbox Code Playgroud) 在开发我的应用程序时,我创建了一个 RecyclerView,其中包含可扩展的 CardView,然后提到“嘿,为什么当我仅对卡片的垂直尺寸和扩展的不透明度进行动画处理时,高度会发生一些变化?” 。
然后我发现改变的不是高度——而是影子改变了。
有人听说过吗?难道只是界面绘制的一个未描述的东西?我不反对很酷的功能,但它只是让我有点困惑(我什至花了大约一个小时在谷歌指南上找到了一些关于它的信息)
我已经分享了证明“高度影响阴影绘制”这一想法的代码,但如果背后还有更多信息,请分享一些信息。