Framelayout frame layout of Android layout _android

Source: Internet
Author: User

Objective

As one of the simplest layouts in the Android six-part layout, the layout creates a blank area directly on the screen,

When we add components to the inside, all the components are placed in the upper-left corner of the area.

The size of the frame layout is determined by the largest child control in the control, and if all components are the same, you can only see the topmost component at the same time!

Of course, we can also add the Layout_gravity attribute to the component to develop the way the component is

The frame layout is used more in the game development aspect, later will give everybody to demonstrate the more interesting two examples

Introduction to (-) frame layouts

The Frame layout container creates a blank area for each of the joined components called a frame each subassembly occupies a frame that is automatically aligned according to Gravity's properties

(ii) Common properties:

Android:foreground: Sets the foreground image for the frame layout container

Android:foregroundgravity: Set the location where the foreground image is displayed

(iii) Use

<?xml version= "1.0" encoding= "Utf-8"?> <linearlayout xmlns:android= "http://schemas.android.com/apk/res/" Android "Android:layout_width=" Match_parent "android:layout_height=" Match_parent "> <framelayout android: Layout_width= "Match_parent" android:layout_height= "wrap_content" > <textview android:layout_width= "Wrap_con" Tent "android:layout_height=" wrap_content "android:layout_gravity=" center "android:width=" 300DP "Android:heigh t= "300DP" android:background= "#f00"/> <textview android:layout_width= "Wrap_content" android:layout_height = "Wrap_content" android:layout_gravity= "center" android:width= "200DP" android:height= "200DP" Android:backgroun d= "#0f0"/> <textview android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android:lay out_gravity= "center" android:width= "100DP" android:height= "100DP" android:background= "#00f"/> </framelayou T> </LinearLayout>

The above content to introduce the Android layout of the Framelayout frame layout, I hope you like.

Related Article

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.