Positioning Android GridLayout images

0

UPDATE

I'm developing a mobile application, using the gridLayout and would like to leave one image next to the other, in case the imageView1 on the imageView2 side, below imageViem3 next to the imageView4 but now image imageView2, imageView3, imageView4 space for mobile phone screen

<?xmlversion="1.0" encoding="utf-8"?>
<ScrollView 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="match_parent"
android:layout_height="match_parent"
tools:context="com.example.tulio.exercicio5.MainActivity">


<GridLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:columnCount="2"
    android:rowCount="3"
    android:orientation="horizontal">



    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        app:srcCompat="@drawable/aliados"
        android:layout_column="0"
        android:layout_row="0"
        />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/chamado3"
        android:layout_column="1"
        android:layout_row="0"
        android:layout_gravity="fill_horizontal"
        android:layout_marginRight="290dp"

        />



    <ImageView
        android:id="@+id/imageView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/regresso"
        android:layout_row="1"
        android:layout_column="1"
        />

    <ImageView
        android:id="@+id/imageView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_column="1"
        android:layout_gravity="fill_vertical"
        android:layout_row="1"
        app:srcCompat="@drawable/john_wick" />


    <ImageView
        android:id="@+id/imageView6"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/residentevil6"
        android:layout_below ="@+id/imageView4"/>


    <ImageView
        android:id="@+id/imageView7"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/xxxreativado"
        android:layout_toLeftOf="@+id/imageView6"/>

</GridLayout>

    
asked by anonymous 21.08.2017 / 21:00

1 answer

1

% w / o your third ImageView is width , so it takes up the full width of the scrollView

UPDATE: I adjusted the dimensions, rows and columns. Something like:

<ImageView
    android:id="@+id/imageView"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    app:srcCompat="@drawable/aliados"
    android:layout_column="0"
    android:layout_row="0"
    />

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:srcCompat="@drawable/chamado3"
    android:layout_column="1"
    android:layout_row="0"
    />



<ImageView
    android:id="@+id/imageView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:srcCompat="@drawable/regresso"
    android:layout_row="1"
    android:layout_column="0"
    />

<ImageView
    android:id="@+id/imageView4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_column="1"
    android:layout_row="1"
    app:srcCompat="@drawable/john_wick" />


<ImageView
    android:id="@+id/imageView6"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:srcCompat="@drawable/residentevil6"
    android:layout_column="1"
    android:layout_row="2"/>


<ImageView
    android:id="@+id/imageView7"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:srcCompat="@drawable/xxxreativado"
    android:layout_column="1"
    android:layout_row="2"/>

    
21.08.2017 / 22:06