Skip to content

Instantly share code, notes, and snippets.

@sheerazam
Last active April 11, 2016 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sheerazam/9626466d85d9d0b43ef5506241731362 to your computer and use it in GitHub Desktop.
Save sheerazam/9626466d85d9d0b43ef5506241731362 to your computer and use it in GitHub Desktop.
public class SplashActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
int SPLASH_DISPLAY_LENGHT = 1000;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent mainIntent = new Intent( SplashActivity.this, MainActivity.class);
SplashActivity.this.startActivity(mainIntent);
SplashActivity.this.finish();
}
},SPLASH_DISPLAY_LENGHT);
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fff">
<ImageView
android:id="@+id/left_bar"
android:layout_width="238dp"
android:layout_height="221dp"
android:src="@drawable/splash_top"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"/>
<ImageView
android:layout_marginTop="-30dp"
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/splash_logo"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
/>
<ImageView
android:layout_marginTop="10dp"
android:id="@+id/right_bar"
android:layout_width="253dp"
android:layout_height="178dp"
android:src="@drawable/splash_bottom"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment