Android Layout Properties Layoutparams understanding

Source: Internet
Author: User

In a written test to confuse the use of layoutparams, special to summarize:

Layoutparams inherits from Android.View.ViewGroup.LayoutParams.
Layoutparams is equivalent to a layout information package that encapsulates the location, height, and width of the layout. Suppose that an area on the screen is occupied by a layout, and if a view is added to a layout, it is best to tell the user how it is intended to be laid out, that is, to pass in an approved layoutparams.
Can describe Layoutparams, on the chess board, each piece occupies a position, that is, each piece has a position of information, such as this piece in 4 rows and 4 columns, where the "4 Rows 4 Columns" is the layoutparams of the pieces. But the Layoutparams class also simply describes the width of the height, width and height can be set to three kinds of values:
1, a definite value;
2,fill_parent, which is filled (as large as the parent container);
3,wrap_content, that is, wrapping the components is good.

Mtextview.setlayoutparams (New Framelayout.layoutparams (FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));

Android Layout Properties Layoutparams understanding

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.