FrameLayout of Android UI (frame layout)

Source: Internet
Author: User

FrameLayout of Android UI (frame layout)
FrameLayout of Android UI (frame layout)

Note: The frame layout opens up a blank area (referred to as a frame) for each component. These frames are stacked together layer by layer, which is somewhat similar to posters mounted on layer by layer, later components overwrite the previous components.

FrameLayout has two special common attributes:

1 android: foreground

Corresponding Method: setForeground (Drawable)
Description: sets the foreground image of the frame layout. Generally, this attribute is used to specify a Drawable object for adding the pressed state to the layout.
Example:

<framelayout android:foreground="@drawable/muogu" android:layout_height="fill_parent" android:layout_width="fill_parent">    
      
       
        
         
      
     
    
   
  </framelayout>

Authorization + authorization + uxs76wyau1xMewvrDJq7XE0Ke5 + 6GjPC9wPg0KPGgzIGlkPQ = "2-foregroundgravity"> 2 foregroundGravity

Corresponding Method: setForegroundGravity (int)
Note: You can see the name. It must be related to the placement of the front view. Yes, the function of this attribute is to define the gravity attribute of the foreground image, so this attribute must be used with foreground. The option gravity is the same. You can find the attribute table in my previous Android UI LinearLayout (linear layout.
Example:

<framelayout android:foreground="@drawable/muogu" android:foregroundgravity="bottom|right" android:layout_height="fill_parent" android:layout_width="fill_parent">    
      
       
        
         
      
     
    
   
  </framelayout>

The only difference between the above Code is that the following line of code is added to FrameLayout.

android:foregroundGravity=bottom|right

As you can see, the foreground image is restored to the original size and placed in the lower right corner according to the settings. As a result, the child components in FrameLayout are displayed.

 

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.