Getting Started with Android (v) Screen components 5.4 Tablelayout table layouts

Source: Internet
Author: User

Tablelayout can organize views into rows or columns. You can use the <TableRow> element to specify a row in the table. Each row can also contain one or more views. Each view in each row makes up one element of the table. The width of each column is determined by the view with the largest width in the column.

Observe the code in the Main.xml:

<?xml version= "1.0" encoding= "Utf-8"?> <tablelayout xmlns:android= "http://schemas.android.com/apk/res/" Android "Android:layout_width=" Fill_parent "android:layout_height=" fill_parent "> <tablero    
       
        w> <textview android:text= "User Name:" android:width= "120DP"/>    
    <edittext android:id= "@+id/txtusername" android:width= "200DP"/>    
       
        </TableRow> <TableRow> <textview android:text= "Password:"/>    
    <edittext android:id= "@+id/txtusername" android:password= "true"/> </TableRow> <TableRow> <textview/> <c 
            Heckbox android:id= "@+id/chkrememberpassword" android:layout_width= "Fill_parent" Android:layout_height= "Wrap_cOntent "android:text=" Remember Password "/> </TableRow> <TableRow>    
    <button android:id= "@+id/buttonsignin" android:text= "Log in"/> </TableRow> </TableLayout>

Effect diagram on Simulator:

In the example above, there are 2 columns and 4 rows in Tablelayout. Just below the "Password" TextView view is an empty <TextView> element. If not, the "Remember Password" checkbox appears under the Password TextView view, like this:

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

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.