Advanced user interface for applications with animations

Animations can bring visual cues to inform users about the application and improve their understanding of the interface. Animations are also useful when downloading content or when the screen changes status. It also provides great interface images for applications.

Animations can bring visual cues to inform users about the application and improve their understanding of the interface. Animations are also useful when downloading content or when the screen changes status. It also provides great interface images for applications.

Animation does not necessarily make the application more beautiful but it draws the attention of users and enhances their experience. With thousands of apps available every day, animations make using the app no ​​longer boring or annoying to users.

  1. Top 10 great apps only available on Android

Picture 1 of Advanced user interface for applications with animations

Some reasons to incorporate animations into applications:

  1. To attract users - Animations can attract users before downloading full content. This will prevent users from giving up the application. Gmail is a good example of this. It uses animations in the pull-to-refresh feature (pull down to refresh) and spinner to download new emails.
  2. Provide feedback - Animation that provides visual feedback that indicates a certain event or action has been completed or to display websites that are not working properly. Animations can be used in buttons, tabs and other components informing users about the current state of the application, especially in e-commerce applications.
  3. G help users navigate - This is especially useful when content changes. For example, dynamic scroll bars can be used to display the transition between tabs and items in the menu. Most applications will have an introduction screen, an introduction to the most important features of the application or simply explaining to the user about the application.

This is how you can add some animations in the application to improve the user experience.

Create an introduction slider (Introduction Slider )

This slider introduces various features of the application. Users can navigate through the screen using swipe gestures or skip the introduction and go to the main application.

The introduction slider will only be displayed when the application is launched for the first time. The next launch will take the user directly to the main screen. This article will guide you to create three slides in the application to display the three most important aspects of the application.

The end result will look like this:

Picture 2 of Advanced user interface for applications with animations

Add this XML to a new file named slide.xml:



android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">


android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/shop"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />


android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">


android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/shop"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />


android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">


android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/shop"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />


android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">


android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/shop"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />

Add the following code to slide2.xml:

 
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/earn"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />


android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/earn"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />


android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/earn"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />


android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/earn"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />

And add the following lines in slide3.xml:



android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/redeem"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />


android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/redeem"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />


android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/redeem"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />


android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f64c73">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/redeem"
android:textColor="@android:color/white"
android:textSize="30dp"
android:textStyle="bold" />

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/slide_1_title"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="16dp" />

Next, we will design the welcome screen. Create another activity (activity_welcome.xml) and add the following XML file:



xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />

android:id="@+id/welcomeLayout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal">

android:layout_width="match_parent"
android:layout_height="1dp"
android:alpha=".5"
android:layout_above="@id/welcomeLayout"
android:background="@android:color/white" />

android:id="@+id/btn_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@null"
android:text="@string/next"
android:textColor="@android:color/white" />

android:id="@+id/btn_skip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@null"
android:text="@string/skip"
android:textColor="@android:color/white" />

xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />

android:id="@+id/welcomeLayout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal">

android:layout_width="match_parent"
android:layout_height="1dp"
android:alpha=".5"
android:layout_above="@id/welcomeLayout"
android:background="@android:color/white" />

android:id="@+id/btn_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@null"
android:text="@string/next"
android:textColor="@android:color/white" />

android:id="@+id/btn_skip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@null"
android:text="@string/skip"
android:textColor="@android:color/white" />

xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />

android:id="@+id/welcomeLayout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal">

android:layout_width="match_parent"
android:layout_height="1dp"
android:alpha=".5"
android:layout_above="@id/welcomeLayout"
android:background="@android:color/white" />

android:id="@+id/btn_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@null"
android:text="@string/next"
android:textColor="@android:color/white" />

android:id="@+id/btn_skip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@null"
android:text="@string/skip"
android:textColor="@android:color/white" />

xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />

android:id="@+id/welcomeLayout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal">

android:layout_width="match_parent"
android:layout_height="1dp"
android:alpha=".5"
android:layout_above="@id/welcomeLayout"
android:background="@android:color/white" />

android:id="@+id/btn_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@null"
android:text="@string/next"
android:textColor="@android:color/white" />

android:id="@+id/btn_skip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@null"
android:text="@string/skip"
android:textColor="@android:color/white" />

xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />

android:id="@+id/welcomeLayout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal">

android:layout_width="match_parent"
android:layout_height="1dp"
android:alpha=".5"
android:layout_above="@id/welcomeLayout"
android:background="@android:color/white" />

android:id="@+id/btn_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@null"
android:text="@string/next"
android:textColor="@android:color/white" />

android:id="@+id/btn_skip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@null"
android:text="@string/skip"
android:textColor="@android:color/white" />

xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />

android:id="@+id/welcomeLayout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal">

android:layout_width="match_parent"
android:layout_height="1dp"
android:alpha=".5"
android:layout_above="@id/welcomeLayout"
android:background="@android:color/white" />

android:id="@+id/btn_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@null"
android:text="@string/next"
android:textColor="@android:color/white" />

android:id="@+id/btn_skip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@null"
android:text="@string/skip"
android:textColor="@android:color/white" />

The XML file contains a page viewer that includes strokes and buttons, bringing the user to the next screen (or returning to the previous screen). You will also need strings.xml for definitions like '@ string / redeem' etc .


Animation
Home Screen
NEXT
SKIP
GOT IT
SHOP
EARN
REDEEM POINTS
SHOP FOR YOUR FAVORITE ITEMS

As mentioned at the beginning of this tutorial, the welcome screen is only displayed when you first run the application. To do this, create a class called PrefManager.java and call setFirstTimeLaunch (true) when the application is first launched.

 package com.example.vaatiesther.animation; 
import android.content.Context;
import android.content.SharedPreferences;
/**
* Created by vaatiesther on 11/8/17.
*/
public class PrefManager {
SharedPreferences preferences;
SharedPreferences.Editor editor;
Context _context;
int PRIVATE_MODE = 0;

private static final String PREF_NAME = "welcome";
private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch";
public PrefManager(Context context) {
this._context = context;
preferences = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
editor = preferences.edit();
}

public void setFirstTimeLaunch(boolean isFirstTime) {
editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime);
editor.commit();
}

public boolean isFirstTimeLaunch() {
return preferences.getBoolean(IS_FIRST_TIME_LAUNCH, true);
}
}

Finally, add the following code to WelcomeActivity.java:

 package com.example.vaatiesther.animation; 
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Context;
import android.content.Intent;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
public class WelcomeActivity extends AppCompatActivity {
private ViewPager viewPager;
private PrefManager prefManager;
private MyViewPagerAdapter myViewPagerAdapter;
private int[] layouts;
private LinearLayout welcomeLayout;
private Button btnSkip, btnNext;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Checking for first time launch - before calling setContentView()
prefManager = new PrefManager(this);
if (!prefManager.isFirstTimeLaunch()) {
launchHomeScreen();
finish();
}
setContentView(R.layout.activity_welcome);
viewPager = (ViewPager) findViewById(R.id.view_pager);
welcomeLayout = (LinearLayout) findViewById(R.id.welcomeLayout);
btnSkip = (Button) findViewById(R.id.btn_skip);
btnNext = (Button) findViewById(R.id.btn_next);
//add welcome slide layouts
layouts = new int[]{
R.layout.slide1,
R.layout.slide2,
R.layout.slide3};
myViewPagerAdapter = new MyViewPagerAdapter();
viewPager.setAdapter(myViewPagerAdapter);
viewPager.addOnPageChangeListener(viewPagerPageChangeListener);
btnSkip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
launchHomeScreen();
}
});
btnNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// checking for last page
// if last page home screen will be launched
int current = getItem(+1);
if (current < layouts.length) {
// move to the next screen
viewPager.setCurrentItem(current);
} else {
launchHomeScreen();
}
}
});
}
private int getItem(int i) {
return viewPager.getCurrentItem() + i;
}
private void launchHomeScreen() {
prefManager.setFirstTimeLaunch(false);
startActivity(new Intent(WelcomeActivity.this, MainActivity.class));
finish();
}
// viewpager change listener
ViewPager.OnPageChangeListener viewPagerPageChangeListener =
new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
// changing the next button text 'NEXT' / 'GOT IT'
if (position == layouts.length - 1) {
// for the last page, make button text to GOT IT
btnNext.setText(getString(R.string.start));
btnSkip.setVisibility(View.GONE);
} else {
// still pages are left
btnNext.setText(getString(R.string.next));
btnSkip.setVisibility(View.VISIBLE);
}
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
@Override
public void onPageScrollStateChanged(int arg0) {
}
};
/**
* View pager adapter
*/
public class MyViewPagerAdapter extends PagerAdapter {
private LayoutInflater layoutInflater;
public MyViewPagerAdapter() {
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = layoutInflater.inflate(layouts[position], container, false);
container.addView(view);
return view;
}
@Override
public int getCount() {
return layouts.length;
}
@Override
public boolean isViewFromObject(View view, Object obj) {
return view == obj;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
View view = (View) object;
container.removeView(view);
}
}
}

Don't forget to put WelcomeActivity as the launcher in the Manifest file:






Dynamic button

Buttons are an integral part of any application because they communicate and provide feedback when clicked. In the drawable folder, add an XML file drawable (drawable / ripple.xml) that will be used as the background for the node to achieve a ripple effect.



xmlns:tools="http://schemas.android.com/tools"
android:color="#f816a463"
tools:targetApi="lollipop">





Edit the button to use XML wavy for the wallpaper, as shown below.

 
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple"
android:padding="16dp"
android:text="Click Me" />

Now the button will show ripples when touched.

You can add interesting and useful animations to your application with some simple techniques. It should be noted that although animations are important to enhance the user experience, misusing animations or using them improperly can also reduce the quality of the experience.

I wish you all success!

Update 25 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile