Android Phone defender--home Interface layout

Source: Internet
Author: User

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

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.