Android Constraintlayout Layout

Source: Internet
Author: User

Android has 6 most basic layout linear layouts (linearlayout), relative layouts (relativelayout), frame layouts (framelayout), grid layouts (GridLayout), absolute layouts (absolutelayout), There are also more complex layouts, such as constraintlayout, outside the table layout (tablelayout).
1. Advantages
More flexible and powerful when adjusting the position and size of controls.
2. Succession relations
Inherit from ViewGroup as with other layouts.
3. New features
Relative positioning:
<button android:id= "@+id/buttona" .../>
<button android:id= "@+id/buttonb" ...
app:layout_constraintleft_torightof= "@+id/buttona"/>
Right-aligned button A for button b

  • Layout_constraintleft_toleftof//Left Justify left
  • Layout_constraintleft_torightof//Left Right align
  • Layout_constraintright_toleftof//Right-left align
  • Layout_constraintright_torightof//Right-justified on right
  • LAYOUT_CONSTRAINTTOP_TOTOPOF//top edge Alignment
  • Layout_constrainttop_tobottomof//Align Top Bottom
  • LAYOUT_CONSTRAINTBOTTOM_TOTOPOF//Bottom Top align
  • Layout_constraintbottom_tobottomof//Bottom align below
  • layout_constraintbaseline_tobaselineof//text content baseline Alignment
  • Layout_constraintstart_toendof//Start side-to-tail alignment
  • Layout_constraintstart_tostartof//Start edge aligned to start edge
  • Layout_constraintend_tostartof//tail aligned to start edge
  • LAYOUT_CONSTRAINTEND_TOENDOF//tail-aligned to tail
    Outer margin:
    <android.support.constraint.constraintlayout ...>
    <button android:id= "@+id/button" ...
    app:layout_constraintleft_toleftof= "Parent"
    App:layout_constraintright_torightof= "parent/>
    <android.support.constraint.ConstraintLayout/>
    Spatial center Effect
    Tendency:
    <android.support.constraint.constraintlayout ...>
    <button android:id= "@+id/button" ...
    App:layout_constrainthorizontal_bias= "0.3"
    app:layout_constraintleft_toleftof= "Parent"
    App:layout_constraintright_torightof= "parent/>
    <android.support.constraint.ConstraintLayout/>
    Left 0.3, right 0.7
    Performance of Visibility:
    Dimension constraints:
    Android:minwidth Setting the minimum width of the layout
    Android:minheight Setting the minimum height of the layout
    CHAIN:
    Accessibility tools:

Android Constraintlayout 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.