Android Studio Linearlayout generating error while scrolling

Asked

Viewed 79 times

-2

Greetings, My android application has a Linearlayout and, within it, a Gridview that is being filled correctly with the images I want.

The problem is that by scrolling the screen down (to see the rest of the icons), the last icons are out of order and the scrolling no longer works. Only by restarting the app Gridview starts working again.

Follow the code and screen with the problem:

    <LinearLayout
    android:id="@+id/layScroll"
    android:layout_width="413dp"
    android:layout_height="447dp"
    android:background="@color/branco"
    android:orientation="horizontal"
    android:paddingLeft="0dp"
    android:paddingTop="50dp"
    android:paddingRight="0dp"
    android:paddingBottom="0dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="@id/frmPrincipal"
    app:layout_constraintStart_toStartOf="@id/frmPrincipal"
    app:layout_constraintTop_toBottomOf="@+id/imageView2">

    <GridView
        android:id="@+id/grvMain"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:columnWidth="60dp"
        android:horizontalSpacing="10dp"
        android:numColumns="2"
        android:verticalSpacing="10dp"
        app:layout_constraintTop_toTopOf="parent">

    </GridView>
</LinearLayout>

The good screen (as soon as you open the app):

inserir a descrição da imagem aqui

The bad screen (after you do the Scroll - I put several identical images to test the scroll):

inserir a descrição da imagem aqui

After making the Scroll, the screen kind of hangs for at least 15 seconds and the icons are all messy inside the Gridview.

I tried to use Scrollview too and gave the same error/result.

2 answers

0


Solved. After several days without answers and/or help, I decided to delete Gridview from my application and use Cardview and Tablelayout

-2

A tip, use Scrollview as Parent View, inside it use the layout you want (Linearlayout, Relativelayout, ...), in this layout put your views.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.