简体   繁体   English

滚动时如何在recyclerview中保持阴影

[英]How to hold shadow in recyclerview while scrolling

I am using shadow library in horizontal recyclerview and whenever i scroll left or right shadow will disappears我在水平 recyclerview 中使用阴影库,每当我向左或向右滚动时,阴影都会消失

<com.gigamole.library.ShadowLayout
            android:id="@+id/go_shadow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_centerInParent="true"
            app:sl_shadow_angle="90"
            app:sl_shadow_color="@color/shadow_color"
            app:sl_shadow_distance="10dp"
            app:sl_shadow_radius="10dp"
            app:sl_shadowed="true"
            >

        <ImageView
            android:id="@+id/downloadIcon"
            android:layout_width="@dimen/go_width"
            android:layout_height="@dimen/go_height"
            android:background="@drawable/ripple_effect"
            android:src="@drawable/ic_go_manual" />
        </com.gigamole.library.ShadowLayout>

For reference以供参考
shadow library影子图书馆

pic before scroll滚动前的图片

pic after scroll滚动后的图片

if you want a shadow effect for an image view.如果您想要图像视图的阴影效果。 Then ad these lines of code for your image view:然后为您的图像视图添加这些代码行:

    android:elevation="25dp"
    android:outlineProvider="bounds"

if you want a shadow effect for Card view.如果您想要卡片视图的阴影效果。 Then ad these lines of code for your Card view:然后为您的卡片视图添加这些代码行:

app:cardElevation="15dp"
app:cardCornerRadius="8dp"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM