Google launches Android responsive layout control flexboxlayout-Box model

Source: Internet
Author: User


Google's latest Android control flexboxlayout is popping up on the GitHub leaderboard today .


What exactly is flexboxlayout ?


Fexbox, also known as the box model, is widely used for front-end development, and the front-end Web is known to have a powerful CSS grid style in Bootstrap .

The emergence of Bootstrap greatly improves the efficiency of front-end development and leads to the trend of responsive layout and cross-platform development.

Flexboxlayout is a powerful control similar to bootstrap in the grid system.


The first few Google sample programs












The advent of flexboxlayout has the potential to have a significant impact on Android screen adaptation. This layout is more flexible. Let's take a look at his basic usage.


<pre name= "code" class= "java" ><com.google.android.flexbox.flexboxlayout xmlns:android= "/http/ Schemas.android.com/apk/res/android "xmlns:tools=" Http://schemas.android.com/tools "xmlns:app="/HTTP/ Schemas.android.com/apk/res-auto "android:id=" @+id/flexbox_layout "android:layout_width=" Match_parent "Android:la yout_height= "Match_parent" app:layout_behavior= "@string/appbar_scrolling_view_behavior" app:flexWrap= "wrap" app:a    lignitems= "Flex_start" app:aligncontent= "Flex_start" app:flexdirection= "column" app:justifycontent= "Flex_end" tools:showin= "@layout/activity_main" > <textview android:id= "@+id/textview1" android:layout_width= "        @dimen/flex_item_length2 "android:layout_height=" @dimen/flex_item_length "android:text=" @string/one " style= "@style/flexitem"/> <textview android:id= "@+id/textview2" android:layout_width= "@dimen/flex_ Item_length3 "android:layout_height=" @dimen/fleX_item_length "android:text=" @string/two "style=" @style/flexitem "/> <textview androi D:id= "@+id/textview3" android:layout_width= "@dimen/flex_item_length" android:layout_height= "@dimen/flex_item _length "android:text=" @string/three "style=" @style/flexitem "/></com.google.android.flexbox.flexboxla Yout>


From the code we can see that this control has a few more properties

app:flexwrap= "wrap"//child controls are wrapped automatically

App:alignitems= the alignment of the "Flex_start"//child control in the row/column in which it is located

app : aligncontent= "Flex_start"// content alignment from the beginning or the end

app : flexdirection= "column"// sub-control arrangement, column or row (can be arranged in reverse order)

app : justifycontent= alignment of "flex_end"// sub-control rows, middle or both ends


From the example of Google tips Flexboxlayout is very powerful, more advantages to everyone to find


Click to open the link source code and examples

Https://github.com/google/flexbox-layout





Google launches Android responsive layout control flexboxlayout-Box model

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.