This article realizes when enters the hone interface from the splash interface, produces a gradual fade in the animation effect, calls a method Initanimation () in the OnCreate, the code is as follows:
/** * Add fade-in animation effect * /privatevoid initanimation ( ) { New alphaanimation (0, 1); Alphaanimation.setduration (+); Rl_root.startanimation (alphaanimation); }
Where rl_root is defined in the class
Private Relativelayout Rl_root;
Where Rl_root is the id:android:id= "@+id/rl_root" of the relative layout of the splash interface
This article address: http://www.cnblogs.com/wuyudong/p/5906385.html, reprint please indicate source address.
Then add the appropriate code in the Initialize UI method
/** * Initialize UI method alt+shift+j* /privatevoid Initui () { = (TextView) Findviewbyid (r.id.tv_version_name); = (relativelayout) Findviewbyid (r.id.rl_root); }
This achieves the fade-in effect of the splash interface.
The next step to implement the home interface, the first implementation is the title bar, the effect is as follows:
The code is as follows:
<TextViewAndroid:text= "Feature List"android:gravity= "Center"android:textsize= "20SP"Android:textcolor= "#000"android:padding= "10DP"Android:background= "#0f0"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content" />
However, because the style of the title bar is very common, all write it as a style wrapper for immediate invocation later, then add the following code in the Style.xml file:
<stylename= "TitleStyle"> <Itemname= "Android:gravity">Center</Item> <Itemname= "Android:textsize">20sp</Item> <Itemname= "Android:textcolor">#000</Item> <Itemname= "Android:padding">10dp</Item> <Itemname= "Android:background">#0f0</Item> <Itemname= "Android:layout_width">Match_parent</Item> <Itemname= "Android:layout_height">Wrap_content</Item> </style>
This requires only a simple invocation in the Activity_home.xml:
< TextView Android:text = "Feature List" style= "@style/titlestyle"/>
Android Phone defender--home Interface layout