Tuesday 27 September 2016

App startup loading screen



activity_main.xml


<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     
xmlns:tools="http://schemas.android.com/tools" 
 android:id="@+id/activity_main" 
 android:layout_width="match_parent" 
 android:layout_height="match_parent"     
tools:context="com.example.pkm1.testapp.MainActivity">

    <TextView 
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:text="Hello World!" />
</RelativeLayout>



MainActivity.java



import android.app.Dialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;

public class MainActivity extends AppCompatActivity {

  @Override    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);

      final Dialog dialog = new Dialog(this);
      dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
      dialog.setContentView(R.layout.spalashscreen);
      dialog.show();

    }
}

splashscreen.xml



<?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     
android:orientation="vertical"  
android:layout_width="match_parent"     
android:layout_height="match_parent" 
 android:background="@drawable/splash"    >

    <LinearLayout 
 android:layout_width="match_parent"         
android:layout_height="wrap_content" 
 android:orientation="vertical" 
 android:layout_alignParentBottom="true" 
 android:layout_marginBottom="100dp">
<ProgressBar 
 android:layout_width="match_parent" 
 android:layout_height="wrap_content" 
 android:indeterminate="true"     
android:layout_gravity="center"/>
 <TextView 
 android:layout_height="wrap_content" 
 android:layout_width="wrap_content" 
 android:text="please wait..." 
 android:layout_gravity="center_horizontal"/>

<TextView         
android:layout_height="wrap_content" 
 android:layout_width="wrap_content" 
 android:text="Checking Server and Network Connectivity"         
android:layout_gravity="center_horizontal"/>
    </LinearLayout>
</RelativeLayout>


Image drawable for screen

splash.jpg







No comments:

Post a Comment