<Relativelayout xmlns: Android = "http://schemas.android.com/apk/res/android" xmlns: Tools = "http://schemas.android.com/tools" Android: layout_width = "fill_parent" Android: layout_height = "match_parent" Android: background = "@ drawable/bg_ling"> <imageview Android: Id = "@ + ID/image" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" Android: src = "@ drawable/welcome"/> <textview Android: Id = "@ + ID/compete" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_centerhorizontal = "true" Android: layout_centervertical = "true" Android: text = "@ string/hello_world"/> <progressbar Android: Id = "@ + ID/prograssbar" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" style = "@ Android: ATTR/progressbarstyle" Android: visibility = "gone" Android: layout_above = "@ ID/compete" Android: layout_centerhorizontal = "true"/> </relativelayout>
Package CN. BZU. alphaanimation; import android. OS. bundle; import android. OS. handler; import android. app. activity; import android. content. intent; import android. view. menu; import android. view. view; import android. view. animation. alphaanimation; import android. widget. imageview; import android. widget. progressbar; public class alphaanimationactivity extends activity {private progressbar; private imageview image; @ override public void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. activity_alpha_animation); progressbar = (progressbar) This. findviewbyid (R. id. prograssbar); image = (imageview) This. findviewbyid (R. id. image); progressbar. setvisibility (view. visible); // create an animation object for the fade-in effect: alphaanimation animation = new alphaanimation (0.0f, 0.1f); animation. setduration (1000); animation. setstartoffset (500); image. setanimation (animation); new handler (). postdelayed (New runnable () {// create a handler to implement the demo jump @ overridepublic void run () {intent = new intent (); intent. setclass (alphaanimationactivity. this, mainactivity. class); startactivity (intent); }}, 1500) ;}@ override public Boolean oncreateoptionsmenu (menu) {getmenuinflater (). inflate (R. menu. activity_alpha_animation, menu); Return true ;}}