Flights search screen with Android source code.

ronnystudio-flight-search-androidstudio
Here is the Flights search screen with clean and ready with Android source code. for your next android project.spending 1000+ hours on building XML layout for your project? , well now, you can relax as you can use our free android kit which is a click away.

Saving your ample hours of designing and developing the Android UI being our goal, We now present to you the news feed app screen with the detailed process.

Step 01 :

Create a new project in Android Studio from the File ⇒ New Project. As it prompts you to select the default activity, select Empty Activity and proceed.

Name your project as per your convenience and click finish.

Download this res.zip and add them to your project res folder. This file contains a few drawable images and font folder required for this app.

For custom fonts folder

ronnystudio-custom-font

Step 02 :

Go to the build Gradle and do the needful changes as follows.

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'de.hdodenhof:circleimageview:3.0.1'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.android.support:design:29.0.2'
    implementation 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
    implementation 'de.hdodenhof:circleimageview:3.0.1'
    implementation 'com.balysv:material-ripple:1.0.2'
    implementation 'com.android.support:support-vector-drawable:29.0.2'
    implementation 'com.makeramen:roundedimageview:2.3.0'
}

Open colors.xml located under res ⇒ values and add the below color values.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#1976D2</color>
    <color name="colorPrimaryDark">#1565C0</color>
    <color name="colorAccent">#FDD835</color>
    <color name="transparent">#00000000</color>
    <color name="white">#ffffff</color>
    <color name="grayTxt">#8c8c8c</color>
    <color name="blue">#344ff4</color>
</resources>

Open strings.xml located under res ⇒ values and add the below values.

<resources>
    <string name="app_name">Flights_search</string>
    <string name="from">From</string>
    <string name="ny">NY</string>
    <string name="new_york">New York</string>
    <string name="to">To</string>
    <string name="hnd">HND</string>
    <string name="tokyo_haneda">Tokyo Haneda</string>
    <string name="depart">Depart</string>
    <string name="type">Type</string>
    <string name="adults">Adults</string>
    <string name="_01">01</string>
    <string name="premium_economy">Premium Economy</string>
    <string name="business_clas">Business Clas</string>
    <string name="economy">Economy</string>
    <string name="first_class">First Class</string>
    <string name="children">Children</string>
    <string name="one_way">One way</string>

</resources>

Open styles.xml located under res ⇒ values and add the below values.

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>

        <item name="windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>

    </style>

</resources>

Step 03 :

Now is the time for making the XML file. For this, Open activity_main.xml and paste the following code.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <include layout="@layout/toolbar_flightsearch" />

    </com.google.android.material.appbar.AppBarLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <include layout="@layout/flight_innerlayout"/>


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="56dp"
            android:background="@color/white"
            android:layout_alignParentBottom="true">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:textSize="15.4sp"
                android:background="@color/blue"
                android:textColor="#ffffff"
                android:letterSpacing="0.02"
                android:lineSpacingExtra="2.6sp"
                android:gravity="center"
                android:layout_gravity="center"
                android:text="Search"
                />

        </LinearLayout>


    </RelativeLayout>





</LinearLayout>




Step 04 :

Now the XML part is done, moving to the next we have to create the Menu folder in resources.

Right-click on the res folder and create a new Android resource directory. and in that folder create one menu resource file. and write the following code. I created menu_basic.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

       <item
        android:orderInCategory="100"
        android:title="Settings"
        app:showAsAction="never" />
</menu>

Step 05 :

Open the Mainactivity.java class file and write the following code.

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
        setSupportActionBar(toolbar);
        getSupportActionBar().setTitle("Book a Flight");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_basic, menu);


        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            finish();
        } else {
            Toast.makeText(getApplicationContext(), item.getTitle(), Toast.LENGTH_SHORT).show();
        }
        return super.onOptionsItemSelected(item);
    }
}

Now run the app and see the output, you will see the awesome Flights search screen with Android source code. for your next android project.

So that’s all for this Flights search screen with Android source code Tutorial. If you are having any confusion or queries please do comment. Thank You.

Facebook
Twitter
LinkedIn
Reddit
StumbleUpon
Pinterest
WhatsApp

Leave a comment

Your email address will not be published. Required fields are marked *

Related Posts