Framelayout Frame layout in Android

Source: Internet
Author: User

The frame layout is represented by Framelayout, and Framelayout directly inherits the Viewgoup component.

The Frame layout container creates a blank area (called a frame) for each component that is added to it, and each subassembly occupies one frame, and the frames are automatically aligned according to the Gravity property.

Code:

<?xml version= "1.0" encoding= "Utf-8"? ><framelayout xmlns:android= "http://schemas.android.com/apk/res/ Android "Android:layout_width=" Match_parent "android:layout_height=" match_parent "android:orientation=" vertical " > <!--define 6 TextView in turn, the first defined TextView is located on the lower level TextView is located on the upper--><textview android:id= "@+id/view01" an Droid:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:layout_gravity= "center" Android:wi Dth= "320px" android:height= "320px" android:background= "#f00"/><textview android:layout_width= "Wrap_con Tent "android:layout_height=" wrap_content "android:layout_gravity=" center "android:width=" 280px "Android:heigh t= "280px" android:background= "#0f0"/><textview android:layout_width= "Wrap_content" Android:layout_heig ht= "wrap_content" android:layout_gravity= "center" android:width= "240px" android:height= "240px" Android:backgro     Und= "#00f"/><textviewAndroid:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:layout_gravity= "Center" android: Width= "200px" android:height= "200px" android:background= "#ff0"/><textview android:layout_width= "Wrap_c Ontent "android:layout_height=" wrap_content "android:layout_gravity=" center "android:width=" 160px "Android:hei ght= "160px" android:background= "#f0f"/><textview android:layout_width= "Wrap_content" android:layout_he ight= "wrap_content" android:layout_gravity= "center" android:width= "120px" android:height= "120px" android:backg Round= "#0ff"/></framelayout>

Effect:


Framelayout Frame layout in Android

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.