Android mobile guard-home interface layout, android-home
This article implements a progressive fade-in animation effect when you enter the hone interface from the splash interface. The Code is as follows:
/*** Add a light animation effect */private void initAnimation () {AlphaAnimation alphaAnimation = new AlphaAnimation (0, 1); alphaAnimation. setDuration (3000); rl_root.startAnimation (alphaAnimation );}
Rl_root is defined in the class.
Private RelativeLayout rl_root;
Rl_root is the relative layout id of the splash interface: android: id = "@ + id/rl_root"
URL: http://www.cnblogs.com/wuyudong/p/5906385.html.
Add the corresponding code in the initialization UI method.
/*** Initialize the UI method alt + shift + j */private void initUI () {TV _version_name = (TextView) findViewById (R. id. TV _version_name); rl_root = (RelativeLayout) findViewById (R. id. rl_root );}
In this way, the fade-in effect of the splash interface is realized.
Next, we will gradually implement the home interface. The title bar is implemented first, and the effect is as follows:
The Code is as follows:
<TextView android: text = "function 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, the style of the title bar is often used, and all styles written as style encapsulation can be called directly later. Therefore, add the following code to the style. xml file:
<style name="TitleStyle"> <item name="android:gravity">center</item> <item name="android:textSize">20sp</item> <item name="android:textColor">#000</item> <item name="android:padding">10dp</item> <item name="android:background">#0f0</item> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> </style>
In this way, you only need to make a simple call in activity_home.xml:
<TextView android: text = "function list" style = "@ style/TitleStyle"/>