Android mobile guard-home interface layout, android-home

Source: Internet
Author: User

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"/>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.