Android tutorial

Android UI Design for and food delivery Boy

Hi, developer in these atrial I am sharing Android UI design for an e-commerce AppDesign a UI for a food delivery Boy. You can create an XML translation file for image Left to right.  TO transfer the image like run a delivery boy. there is some easy step to create this UI just create an activity main screen and on the screen using an image view for translation. Create an animation XML file in res folder to create left to right running an image.

Android UI Design for and food delivery Boy.

Step 1: Create an animation XML file left_to_right.  

in this XML file using a translation to an object left to right. these file using for an image left side to right on the screen

left_to_right.XML

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator"
    android:fillAfter="true">

    <translate
        android:fromXDelta="0%p"
        android:toXDelta="75%p"
        android:duration="1000"
        android:repeatCount="5" />

</set>

Step 2: Open your UI Layout XML file main_activity.xml

in your XML file you can add an image View and used for translation the object to the X, Y coordinates.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:gravity="center"
    android:orientation="vertical"
    android:layout_height="match_parent"
    tools:context="com.codeplayon.deliveryboy.MainActivity">

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:src="@drawable/om_logo"/>

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="100dp"
        android:layout_gravity="left"
        android:src="@drawable/om_delovry_logo"/>
</LinearLayout>

Android UI Design for and food delivery Boy.

Step 3: Open You Java Source code file Main.Java

in your java file, you can implement the translation of left to a right XML file on the image view.

 

public class MainActivity extends AppCompatActivity {
    // Splash screen timer
    ImageView imageView;
    private static int SPLASH_TIME_OUT = 5000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        imageView=(ImageView)findViewById(R.id.imageView1);
        Animation an2= AnimationUtils.loadAnimation(this,R.anim.life_to_right);
        imageView.startAnimation(an2);
        new Handler().postDelayed(new Runnable() {

            /*
             * Showing splash screen with a timer. This will be useful when you
             * want to show case your app logo / company
             */

            @Override
            public void run() {
                // This method will be executed once the timer is over
                // Start your app main activity
                if (AppStatus.getInstance(MainActivity.this).isOnline()) {
                    Intent i = new Intent(MainActivity.this, LogIn.class);
                    startActivity(i);
                    finish();

                    //           Toast.makeText(this,"You are online!!!!",Toast.LENGTH_LONG).show();

                } else {

                    ContextThemeWrapper ctw = new ContextThemeWrapper( MainActivity.this, R.style.Theme_AlertDialog);
                    final android.app.AlertDialog.Builder alertDialogBuilder = new android.app.AlertDialog.Builder(ctw);
                    alertDialogBuilder.setTitle("No internet connection");
                    alertDialogBuilder.setMessage("Check your  internet connection or try again");
                    alertDialogBuilder.setPositiveButton("ok", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {

                        }
                    });
                    alertDialogBuilder.show();
                }

            }
        }, SPLASH_TIME_OUT);
    }
}

https://www.youtube.com/watch?v=lH_dG2bpTJY&t=3s