Skip to main content

Posts

Showing posts from May, 2014

Splash Screen in Android with Animation

  Steps: 1. Create new project. 2. Now insert below code in SplashActivity /*********************************************  SplashScreen.java   ***********************************************/ public class SplashScreen extends Activity { private long ms = 0; private long splashDuration = 5000; private boolean splashActive = true; private boolean paused = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash_screen); AnimateScreen(); } private void AnimateScreen() { // TODO Auto-generated method stub Animation anim = AnimationUtils.loadAnimation(SplashScreen.this, R.anim.alpha); anim.reset(); RelativeLayout l=(RelativeLayout) findViewById(R.id.RelativeLayout1); l.clearAnimation(); l.startAnimation(anim); anim = AnimationUtils.loadAnimation(SplashScreen.this, R.anim.translate); anim.reset(); TextView life = (TextView) findViewById(R.id.textVi...

How to create custom title in Android Application

Custom title is nothing but a layout you bind to your application's title bar. MainActivity.java package com.example.customtitlebar; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.Window; import android.widget.Button; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.activity_main); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.customheader); init(); } private void init() { // TODO Auto-generated method stub Button Left=(Button)findViewById(R.id.header_left_btn); Left.setText("BACK"); Left.setTextColor(Color.GRAY); Button Title=(Button)findViewById(R.id.header_text); Title.setText("Scorecard"); Title.setTextColor(Color.GRAY); Button Right=(Button)findViewById(R.id.header_right_...