"Android" let the child elements beyond the container limit,! How to achieve a more flexible container layout!

Source: Internet
Author: User

Wirelessly LinearLayout is the most handy container, but sometimes seemingly unsatisfactory, in fact, wirelessly container is really flexible.

1. Let the child elements exceed the container limit. Initially imagine that the child element given a margin is a negative number can be exceeded, but the fact is beyond the container part is not drawn out.

is actually can be drawn out, the container of the red container (note is the Red control container, not the red container itself) given android:clipchildren= "false", the default is true, that is, its elements are clipped by its container, note that the reason is the container of the red container, is because the green button highlight is not in the Red container drawing range, but is a container of the red container.



2. The following layout, according to the traditional mode is generally the outermost use of linearlayout, inside the relativelayout, and a variety of disgusting row.

Can actually come a little more readily, a linearlayout container to fix.

<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "Match_parent" android:layout_height= "Match_parent" android:background= "#ffffff" android:cliptopadding= "false" Android:orientati on= "Horizontal" android:padding= "10DP" > <textview android:id= "@+id/tvvip" android:layout_width=        "Wrap_content" android:layout_height= "wrap_content" android:text= "VIP1" android:textcolor= "#000000"        android:textstyle= "Bold"/> <edittext android:id= "@+id/et" android:layout_width= "0DP" android:layout_height= "Wrap_content" android:layout_weight= "1" android:paddingright= "20DP" Android:te        xt= "/> <textview android:layout_width=" wrap_content "android:layout_height=" Wrap_content " android:layout_marginleft= " -20DP" android:text= "Yuan"/> <button android:id= "@+id/btndel" a Ndroid:layout_width= "Wrap_coNtent "android:layout_height=" 20DP "android:layout_marginleft=" -15DP "android:layout_margintop=" -10DP "/></linearlayout>





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.