Vasant Raval
Vasant Raval

Reputation: 303

How to add coulmn of 3 in shimmerframelayout

Hello im trying to add shimmereffect on a imageview in a coulmn of 3 but the issue is the shimmer effetc shows only in one coulmn and not in 3

and also there is another issue where in one my physical device the shimmer effect looks stuck even the device specifications are very good but on other physical and emulator the simmer animation shows smoth and working

here is a screenshot

enter image description here

XML Codes

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>

Upvotes: 2

Views: 860

Answers (1)

Calaquessir
Calaquessir

Reputation: 45

I don't know will it be work but i fixed my problem like this:

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_marginHorizontal="10dp">

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

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_marginHorizontal="10dp"
            android:layout_marginTop="180dp">

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

        </LinearLayout>

    </com.facebook.shimmer.ShimmerFrameLayout>

Hope it will helps...

Upvotes: 1

Related Questions