Android Basics (5): Common components 1

Source: Internet
Author: User

Common Components
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
android:orientation= "Vertical" >
<!--text box --
<textview
Android:layout_width= "Wrap_content"
Android:id= "@+id/textview1"
android:text= "TextView with pictures"
android:drawabletop= "@drawable/ic_launcher"
android:layout_height= "Wrap_content"
/>
<textview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:inputtype= "Textemailaddress"
android:text= "e-mail"
android:height= "50px"
/>
<!--edit box --
<edittext
Android:id= "@+id/email"
Android:layout_width= "300px"
android:layout_height= "Wrap_content"
Android:inputtype= "Textemailaddress"
/>
<!--buttons --
<button
android:text= "Register"
Android:id= "@+id/button1"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
/>
<!--picture buttons --
<imagebutton
android:src= "@drawable/ic_launcher"
Android:background= "#000"
Android:id= "@+id/imagebutton1"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
/>
<!--radio button --
<radiogroup
Android:id= "@+id/radiogroup1"
android:orientation= "Horizontal"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
>
<radiobutton
Android:id= "@+id/radio0"
android:text= "Male"
Android:checked= "true"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
/>
<radiobutton
Android:id= "@+id/radio0"
android:text= "Female"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
/>
</RadioGroup>
<!--multi-box usage--
<textview
android:text= "Hobbies"
Android:width= "100px"
Android:gravity= "Right"
android:height= "50px"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
/>
<checkbox
android:text= "Sports"
Android:id= "@+id/like1"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
/>
<checkbox
Android:text= "Music"
Android:id= "@+id/like2"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
/>
<checkbox
android:text= "Art"
Android:id= "@+id/like1"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
/>
<!--image View --
<imageview
android:src= "@drawable/ic_launcher"
Android:id= "@+id/imbg"
Android:maxwidth= "180px"
android:maxheight= "180px"
Android:adjustviewbounds= "true"
Android:layout_margin= "5px"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
/>
<!--list selection box --
<spinner
android:entries= "@array/ctype"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:id= "@+id/spinner1"
/>
</LinearLayout>


Arrays.xml used by the list selection box


<?xml version= "1.0" encoding= "Utf-8"?>
<resources>
<string-array name= "CType" >
<item> ID Card </item>
<item> Student ID </item>
<item> Work Permits </item>
</string-array>
</resources>

Copyright Notice: Bo Master original articles, reproduced please indicate the source. Http://blog.csdn.net/dzy21

Android Basics (5): Common components 1

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.