Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Description:

I have an activity which has 9 "Image Views". I`ve put images on them loaded from my drawable-v24 folder. The total weight of 9 images together is 992KB (less than 1 megabyte).

XML code of images:

All image views (9) are the same:

<androidx.cardview.widget.CardView
        android:id="@+id/card_img1"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="20dp"
        app:cardCornerRadius="10dp"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/txt_title"
        android:contentDescription="@string/app_name">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:contentDescription="@string/app_name">

            <ImageView
                android:id="@+id/img1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:src="@drawable/img1"
                android:scaleType="fitXY"/>

            <View
                android:id="@+id/view_background1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:alpha="0.4"
                android:background="@drawable/seleccion_categoria" />

            <TextView
                android:id="@+id/txt1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#252525"
                android:alpha="0.6"
                android:fontFamily="@font/open_sans"
                android:gravity="center"
                android:text="@string/img1"
                android:textColor="#ffffff"
                android:textSize="14sp"
                android:paddingTop="2dp"
                android:paddingBottom="2dp"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true" />

        </RelativeLayout>

    </androidx.cardview.widget.CardView>

What did I try?

I reduced size of the images to 992kb all but my activity is still lagging. I think it is important to say that my activity runs well in one of my phones (Motorola moto e 5), and very bad in my other phone (Motorola Moto g4).

Which is the problem? What do I have to do to delete this lag?

Link to download rar folder with 9 images: https://www.mediafire.com/file/sbp7g6jozqgzv9a/images_tomas_menniti.rar/file

Thanks for reading

question from:https://stackoverflow.com/questions/65648819/android-studio-why-my-screen-with-images-is-lagging

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
301 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...