Add imageview and break line

0

I have an image in my set the assets , however the amount will always keep changing, so I need to add a ImageView via code.

But since I do not know the quantity, I do not know when they would come out of the window. I need to check if the image would be out the window and "break a line" and continue placing ImageView .

    
asked by anonymous 19.04.2015 / 15:40

1 answer

1

I did this using 3 LinearLayout

<LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginRight="2dp"
            android:layout_weight="1"
            android:gravity="start"
            android:id="@+id/l1"
            android:layout_alignParentTop="true"></LinearLayout>

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

            android:layout_weight="1"
            android:gravity="start"
            android:id="@+id/l2"
            android:layout_alignParentTop="true"></LinearLayout>

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginLeft="2dp"
            android:layout_weight="1"
            android:gravity="start"
            android:id="@+id/l3"
            android:layout_alignParentTop="true"></LinearLayout>
    </LinearLayout>

More then I divided the cell phone screen only 3, if the cell phone is bigger the image gets bigger if the screen is smaller. The way it is the l1, l2, l3 it divides the screen into 3 every LinearLayout is the same size as the other. I put the images by line of code

    
25.04.2015 / 22:26