0

I want to change the row of a picture. I created the photo in XML code in GridLayout but now I can not change the line in Java code.

XML code :

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    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="400dp"
    android:id="@+id/relativeLayout"
    android:layout_marginTop="180dp"
    tools:context=".EasyMap1">
    <GridLayout
        android:id="@+id/gridlayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:rowCount="6"
        android:columnCount="6">
        <ImageView
            android:id="@+id/car1"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:layout_row="4"
            android:layout_column="1"
            android:layout_columnSpan="2"
            app:srcCompat="@drawable/car1" />
    </GridLayout>


</RelativeLayout>

Java code :

ImageView []car = new ImageView[8];

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_easy_map1);
        gridLayout = findViewById(R.id.gridlayout);

        car[0] = findViewById(R.id.car1);

Is there any way to do this?

Yash
  • 3,438
  • 2
  • 17
  • 33
nosignal
  • 1
  • 1

0 Answers0