Create the layout of the app

Create the layout of the app in activity_main.xml. Download the background image and then add it to the drawable folder. Create a Text view and button as depicted in the image shown below:-

<?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="com.example.askweather.MainActivity">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scaleType="centerCrop"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0"
        app:srcCompat="@drawable/waether1" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="313dp"
        android:layout_height="50dp"
        android:layout_marginTop="60dp"
        android:text="ENTER CITY NAME"
        android:textColor="@android:color/holo_orange_light"
        android:textSize="36sp"
        android:textStyle="bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/imageView" />

    <EditText
        android:id="@+id/editText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="13dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:textColor="@android:color/background_light"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView" />

    <Button
        android:id="@+id/button"
        android:layout_width="256dp"
        android:layout_height="72dp"
        android:layout_marginTop="16dp"
        android:backgroundTint="#2AAE1F1F"
        android:onClick="getWeather"
        android:text="Ask Weather"
        android:textColor="#B6E4E0"
        android:textColorHighlight="#009688"
        android:textColorLink="#E18F0031"
        android:textSize="24sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.496"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/editText" />

    <TextView
        android:id="@+id/resultTextView"
        android:layout_width="388dp"
        android:layout_height="446dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="18dp"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        android:textColor="@android:color/white"
        android:textSize="24sp"
        android:textStyle="bold"
        app:layout_constraintBottom_toBottomOf="@+id/imageView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/button"
        app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>

Discussion
Thank You Didu I am Mandvi from 2020 Batch I am searching you in Teams but You are not there why?

I am not certain why you couldn't find me on teams but if you have any doubts you can hmu on Gmail (janhvi.singh2019@vitbhopal.ac.in) or Linkdein.

Very well written! Great work!

1

Great job! This is really helpful. So proud of you!

1

Woo It's great work Janhvi.

1

8

4