1

I have a very big problem. I want to scroll my FrameLayout that is in Relative Layout. Frame Layout create 2 loops of images, and I want every image show (in 2 columns) and the scrollview works.

<ScrollView
    android:fillViewport="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/frame1"/>

        </RelativeLayout>



</ScrollView>
for (int y=0; y < 3; y++) {
            for (int i = 0; i < 20; i++) {
                index = "car_0";
                final ImageView car = new ImageView(SecondActivity.this);
                car.setLayoutParams(iparams);
                car.setImageResource(R.drawable.car_0);
                car.setY(i * size.y/3-5);
                car.setX(y * size.x/3-5);
                frameLayout.addView(car);
            }

        }

  • You should use RecyclerView, please check if this can help you https://stackoverflow.com/questions/40587168/simple-android-grid-example-using-recyclerview-with-gridlayoutmanager-like-the – rudicjovan Dec 28 '19 at 09:32

0 Answers0