1

您好,我试图在 3 列中的图像视图上添加微光效果,但问题是微光效果仅在 3 列中显示,而不在 3 中显示

还有另一个问题,在我的一个物理设备中,即使设备规格非常好,微光效果看起来也卡住了,但在其他物理设备和模拟器上,微光动画显示平滑且有效

这是一个截图

在此处输入图像描述

XML 代码

Fragment_Profile.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/black"
    android:overScrollMode="never">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:overScrollMode="never"
        android:paddingTop="20dp">

        <include
            android:id="@+id/snipet_profile"
            layout="@layout/snipet_profile" />

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/postRecyclerViewProfile"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:orientation="vertical"
            android:overScrollMode="never" />

        <com.facebook.shimmer.ShimmerFrameLayout
            android:id="@+id/shimmerEffect"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <include layout="@layout/post_item_container_shimmer" />

                <include layout="@layout/post_item_container_shimmer" />

                <include layout="@layout/post_item_container_shimmer" />

                <include layout="@layout/post_item_container_shimmer" />

                <include layout="@layout/post_item_container_shimmer" />

                <include layout="@layout/post_item_container_shimmer" />

                <include layout="@layout/post_item_container_shimmer" />

                <include layout="@layout/post_item_container_shimmer" />

                <include layout="@layout/post_item_container_shimmer" />

                <include layout="@layout/post_item_container_shimmer" />

            </LinearLayout>

        </com.facebook.shimmer.ShimmerFrameLayout>
    </LinearLayout>
</androidx.core.widget.NestedScrollView>

post_item_container_shimmer.xml

<RelativeLayout 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="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="1dp">


    <com.google.android.material.card.MaterialCardView
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_centerInParent="true"
        android:layout_marginStart="3dp"
        android:layout_marginTop="11dp"
        android:layout_marginEnd="3dp"
        app:cardElevation="1dp"
        app:cardMaxElevation="4dp"
        app:shapeAppearanceOverlay="@style/RoundedCorner"
        tools:ignore="ObsoleteLayoutParam">

        <com.google.android.material.imageview.ShapeableImageView
            android:id="@+id/imagePost"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"
            android:background="#E7E7E7"
            android:contentDescription="@string/todo"
            app:shapeAppearanceOverlay="@style/RoundedCorner" />

    </com.google.android.material.card.MaterialCardView>
</RelativeLayout>
4

0 回答 0