Android Layout file Experience

Source: Internet
Author: User

1. When a parent control contains multiple child controls, it often follows the principle that the eldest son takes precedence, that is, if the eldest son is likely to occupy the father's space, the second son is out;

2. Assuming that the Tablelayout has 2 rows, one row does not set the inter-column length ratio, and the other row is set, the non-set row may also follow the set row length ratio between columns;

3. In an area, such as a cell in tablelayout, to display a large picture, you want the picture to always be adaptive to the cell instead of exploding the cell. Solution: Place the cell in LinearLayout, set the Android:layout_width= "Wrap_content", android:orientation= "horizontal" to LinearLayout, Set the Layout_weight property for the cell, and do not set the Android:layout_width property.

<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools "android:layout_width=" match_parent "android:layout_height=" Match_parent "android:backg round= "#ffffff" > <tablelayout android:layout_width= "fill_parent" android:layout_height= "Wrap_conten        T "android:layout_below=" @+id/include1 "android:background=" #dedcd2 "android:stretchcolumns=" * "> <tablerow android:layout_margin= "0.5dip" android:background= "#dedcd2" > <                LinearLayout android:layout_width= "wrap_content" android:layout_height= "30DP"                    android:orientation= "Horizontal" > <textview android:layout_height= "fill_parent" Android:layout_margin= "1dip" android:layout_weight= "2" Android:ba Ckground= "#ffffff" Android: text= "" android:textsize= "12DP" android:textstyle= "bold"/> <t                    Extview android:layout_height= "fill_parent" android:layout_margin= "1dip"                    android:layout_weight= "2" android:background= "#ffffff" android:text= "" Android:textsize= "12DP" android:textstyle= "bold"/> &lt ;!                    --@drawable/right for Super big picture--<imageview android:layout_height= "Fill_parent" Android:layout_margin= "1dip" android:layout_weight= "1" android:src= "@dr                    Awable/right "/> <textview android:layout_height=" Fill_parent "                    Android:layout_margin= "1dip" android:layout_weight= "2" android:background= "#ffffff" android:text= "" android:textsize= "12DP" android:textstyle= "bold"/> </ Linearlayout> </TableRow> </TableLayout></RelativeLayout>


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.