之前有几个好朋友说最近android很火,很想学习下android,在他们的要求下,我给他们讲解了android的一些基础知识,带他们进入android的大门,以下是讲解课程中的第二课,常用UI控件的使用,第一课主要是android的一些简单介绍和环境的搭建,这个可以参考我之前的环境搭建的文章,这些都是比较基础的东西,对初学者有帮助而已,大虾们就不需要浪费时间了。以下这个xml文件中是包含了该课程中的全部UI控件了。

register.xml
<?xml version="1.0" encoding="utf-8"?><ScrollViewxmlns:android="http://schemas.android.com/apk/res/android"  android:layout_width="fill_parent"  android:layout_height="fill_parent"  android:orientation="vertical"  ><LinearLayout  android:layout_width="fill_parent"  android:layout_height="fill_parent"  android:orientation="vertical"  >  <RelativeLayout  android:layout_width="fill_parent"  android:layout_height="wrap_content"  >  <TextView  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:text="@string/nameLable"  android:id="@+id/nameLable"  android:textColor="@drawable/red"  />  <EditText  android:layout_width="fill_parent"  android:layout_height="wrap_content"  android:layout_toRightOf="@id/nameLable"  android:layout_marginLeft="45px"  android:id="@+id/name"  android:maxLength="30"  />  </RelativeLayout>  <RelativeLayout  android:layout_width="fill_parent"  android:layout_height="wrap_content"  >  <TextView  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:text="@string/pwdLable"  android:id="@+id/pwdLable"  android:textColor="@drawable/white"  />  <EditText  android:layout_width="fill_parent"  android:layout_height="wrap_content"  android:layout_toRightOf="@id/pwdLable"  android:layout_marginLeft="45px"  android:id="@+id/pwd"  android:password="true"  />  </RelativeLayout>  <RelativeLayout  android:layout_width="fill_parent"  android:layout_height="wrap_content"  >  <TextView  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:text="@string/cfmpwdLable"  android:id="@+id/cfmpwdLable"  android:textColor="@drawable/other"  />  <EditText  android:layout_width="fill_parent"  android:layout_height="wrap_content"  android:layout_toRightOf="@id/cfmpwdLable"  android:layout_marginLeft="17px"  android:id="@+id/cfmpwd"  android:password="true"  />  </RelativeLayout>  <RelativeLayout  android:layout_width="fill_parent"  android:layout_height="wrap_content"  >  <TextView  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:text="@string/emailLable"  android:id="@+id/emailLable"  android:textColor="@drawable/gray"  />  <EditText  android:layout_width="fill_parent"  android:layout_height="wrap_content"  android:layout_toRightOf="@id/emailLable"  android:layout_marginLeft="45px"  android:id="@+id/email"  android:autoLink="email"  />  </RelativeLayout> <RelativeLayoutandroid:layout_width="fill_parent"android:layout_height="wrap_content"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/sexLable"android:id="@+id/sexLable"android:textColor="@drawable/magenta"/><RadioGroupandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:layout_toRightOf="@id/sexLable"android:layout_marginLeft="15px"android:layout_alignTop="@id/sexLable"><RelativeLayoutandroid:layout_width="fill_parent"android:layout_height="wrap_content"><RadioButtonandroid:layout_width="70px"android:layout_height="wrap_content"android:id="@+id/male"android:text="@string/maleLable"android:checked="true"android:textStyle="italic"/><RadioButtonandroid:layout_width="80px"android:layout_height="wrap_content"android:layout_toRightOf="@id/male"android:id="@+id/female"android:layout_alignTop="@id/male"android:text="@string/femaleLable"android:textStyle="italic"/></RelativeLayout></RadioGroup></RelativeLayout>  <RelativeLayout  android:layout_width="fill_parent"  android:layout_height="wrap_content"  >  <TextView  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:text="@string/birthdayLable"  android:id="@+id/birthdayLable"  android:textColor="@drawable/ltgray"  />  <EditText  android:layout_width="fill_parent"  android:layout_height="wrap_content"  android:layout_toRightOf="@id/birthdayLable"  android:layout_marginLeft="15px"  android:id="@+id/birthday"  android:singleLine="true"  android:clickable="true"  />  </RelativeLayout>   <RelativeLayout  android:layout_width="fill_parent"  android:layout_height="wrap_content"  >  <TextView  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:text="@string/degreeLable"  android:id="@+id/degreeLable"  android:textColor="@drawable/green"  />  <Spinner  android:layout_width="fill_parent"  android:layout_height="wrap_content"  android:layout_toRightOf="@id/degreeLable"  android:layout_marginLeft="15px"  android:id="@+id/degree"  />  </RelativeLayout>  <RelativeLayout  android:layout_width="fill_parent"  android:layout_height="wrap_content"  >  <TextView  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:text="@string/skillLable"  android:id="@+id/skillLable"  android:textColor="@drawable/dkgray"  android:textStyle="bold"  />  <CheckBox  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_toRightOf="@id/skillLable"  android:layout_marginLeft="15px"  android:text="java"  android:id="@+id/java"  />  <CheckBox  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_toRightOf="@id/java"  android:layout_marginLeft="15px"  android:id="@+id/j2ee"  android:text="j2ee"  />  <CheckBox  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_toRightOf="@id/j2ee"  android:layout_marginLeft="15px"  android:id="@+id/android"  android:text="android"  />  </RelativeLayout>  <RelativeLayout  android:layout_width="fill_parent"  android:layout_height="wrap_content"  >  <TextView  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:text="@string/remarkLable"  android:id="@+id/remarkLable"  android:background="@drawable/yellow"  />  <EditText  android:layout_width="fill_parent"  android:layout_height="wrap_content"  android:layout_toRightOf="@id/remarkLable"  android:layout_marginLeft="15px"  android:id="@+id/remark"  android:minLines="3"  />  </RelativeLayout>  <RelativeLayout  android:layout_width="fill_parent"  android:layout_height="wrap_content"  >  <ImageButton  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:id="@+id/submitBtn"  android:layout_marginLeft="50px"  android:src="@drawable/selectcity"  android:tag="@string/submitBtn"  />  <Button  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:id="@+id/resetBtn"  android:layout_toRightOf="@id/submitBtn"  android:layout_marginLeft="30px"  android:text="@string/resetBtn"  />  <Button  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:id="@+id/backBtn"  android:layout_toRightOf="@id/resetBtn"  android:layout_marginLeft="30px"  android:text="@string/backBtn"  />  </RelativeLayout> </LinearLayout> </ScrollView>

更多相关文章

  1. Android 安装环境搭建
  2. Android控件常用属性
  3. 跟着Android官方培训课程学习,挖坑填坑记录
  4. android中控件的遮盖问题
  5. android环境搭建步骤
  6. Android中的多媒体编程-黄俊东-专题视频课程
  7. Android在Eclipse环境下安装配置
  8. [置顶] android Studio 配置LUA 开发环境

随机推荐

  1. android问题记录:Your project path conta
  2. Android(安卓)ORM框架GreenDao入门学习
  3. Android中图形参数及图形内存信息获取
  4. Android Java COOKIES
  5. android实现自动关机代码
  6. android 视频流的格式转换(YUV-RGB)
  7. android图片拖动
  8. Android 上层实现IPC通讯
  9. Ubuntu下使用Android(安卓)ADB
  10. Android(安卓)驱动开发系列一