0% found this document useful (0 votes)
47 views

MainActivity XML

The document defines the layout of a game interface with image views for coins, a character, buttons to move left and right, and text views to display the score and falling coins. It uses a constraint layout as the parent and positions image views and buttons within it using constraints to place them on the screen for the game.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

MainActivity XML

The document defines the layout of a game interface with image views for coins, a character, buttons to move left and right, and text views to display the score and falling coins. It uses a constraint layout as the parent and positions image views and buttons within it using constraints to place them on the screen for the game.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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

>
<androidx.constraintlayout.widget.ConstraintLayout
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=".MainActivity"
android:background="@drawable/background">

<ImageView
android:id="@+id/coin1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/coins1"
tools:layout_editor_absoluteX="112dp"
tools:layout_editor_absoluteY="148dp" />

<ImageView
android:id="@+id/coin2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/coins2"
tools:layout_editor_absoluteX="-39dp"
tools:layout_editor_absoluteY="260dp" />

<ImageView
android:id="@+id/coin3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/coins3"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="136dp" />

<Button
android:id="@+id/leftbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="LEFT"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/rightbtn"
app:layout_constraintHorizontal_bias="0.032"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.989" />

<Button
android:id="@+id/rightbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:text="RIGHT"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.989" />
<ImageView
android:id="@+id/man"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.889"
app:srcCompat="@drawable/mariohead" />

<TextView
android:id="@+id/score"
android:layout_width="106dp"
android:layout_height="49dp"
android:layout_marginTop="4dp"
android:text="0"
android:textAllCaps="false"
android:textColor="#FFEB3B"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.986"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/fallingTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="0"
android:textColor="#FFEB3B"
android:textSize="30sp"
app:layout_constraintEnd_toStartOf="@+id/score"
app:layout_constraintHorizontal_bias="0.065"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

You might also like