1. <?xml version="1.0" encoding="utf-8"?>
    <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"

  1. android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.tw.flag.myhyx.MainHyx">
  2.  
  3. <TextView
    android:layout_width="wrap_content"//设置文本框的宽度
    android:layout_height="wrap_content"//设置文本框的高度
    android:id="@+id/text"//文本框的ID
    android:text="用户名"/>
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/text1"
    android:text="密码"
    android:layout_below="@+id/text"//设置当前空间在某个位置下面
    android:layout_marginTop="10dp"/>指定移动的像素的上偏移值
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/text2"
    android:text="确认密码"
    android:layout_below="@+id/text1"
    android:layout_marginTop="10dp"/>
    <EditText
    android:id="@+id/edit1"
    android:layout_width="200dp"
    android:layout_height="40dp"
    android:inputType="textPersonName"
    android:layout_marginLeft="60dp"
    android:layout_marginTop="-18dp"
    />
    <EditText
    android:id="@+id/edit2"
    android:layout_width="200dp"
    android:layout_height="40dp"
    android:inputType="textPassword"
    android:layout_marginLeft="60dp"
    android:layout_marginTop="10dp"
    />
    <EditText
    android:id="@+id/edit3"
    android:layout_width="200dp"
    android:layout_height="40dp"
    android:inputType="textPassword"
    android:layout_marginLeft="60dp"
    android:layout_marginTop="35dp"
    />
  4.  
  5. <Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="注 册"
    android:id="@+id/button"
    android:layout_below="@+id/edit3"
    android:layout_centerHorizontal="true"//将该空间置于水平居中
    android:layout_marginTop="20dp"
  6.  
  7. />
  8.  
  9. </RelativeLayout>
    //实现男、女的单选控件
  1. <?xml version="1.0" encoding="utf-8"?>
    <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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.tw.flag.mybuju.MainActivity">
  2.  
  3. <EditText
    android:id="@+id/edit_text"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:maxLength="10"
    android:hint="单选框按钮测试"
    android:textColor="#999999"
    android:textColorHint="#999999">
    </EditText>
    <TextView
    android:id="@+id/textview1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="你来自那个城市"
    android:layout_below="@id/edit_text"
    />
    <RadioGroup
    android:id="@+id/radioGroup2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_below="@id/textview1"
    >
    <RadioButton
    android:id="@+id/radioBtn5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="广东"
    android:layout_below="@id/textview1"/>
    <RadioButton
    android:id="@+id/radioBtn6"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="广西"
    android:layout_below="@+id/radioBtn5"/>
    <RadioButton
    android:id="@+id/radioBtn7"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="湖南"
    android:layout_below="@+id/radioBtn6"/>
    </RadioGroup>
  4.  
  5. <View
    android:id="@+id/View8"
    android:layout_width="match_parent"
    android:layout_height="1px"
    android:background="#999999"
    android:layout_below="@+id/radioGroup2"
    />
    <RadioGroup

  1. android:id="@+id/radioGroup3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_below="@id/View8"
    >
    <RadioButton
    android:id="@+id/radioBtn8"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="男"
    android:layout_below="@+id/View8"/>
    <RadioButton
    android:id="@+id/radioBtn9"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="女"
    android:layout_below="@+id/radioBtn8"/>
    </RadioGroup>
    </RelativeLayout>

android控件基本布局的更多相关文章

  1. 探究android控件及布局

    控件(widget) 1. TextView(该控件的一些需要注意的属性,下同) gravity="center"textSize="24sp"textColo ...

  2. Android 控件在布局中按比例放置[转]

    转自:http://netsky1990.blog.51cto.com/2220666/997452       在Android开发中常用到线性布局LinearLayout对界面进行具体的创建,其中 ...

  3. Android 手机卫士--自定义组合控件构件布局结构

    由于设置中心条目中的布局都很类似,所以可以考虑使用自定义组合控件来简化实现 本文地址:http://www.cnblogs.com/wuyudong/p/5909043.html,转载请注明源地址. ...

  4. Android编程 控件与布局

    控件和布局的继承结构 常用控件 1.TextView <?xml version="1.0" encoding="utf-8"?> <Line ...

  5. Android 控件属性介绍

    1.LinearLayout(线性布局): 可以分为水平线性:android:orientation= " horizontal " 和垂直线性:android:orientati ...

  6. Android控件Gridview实现仿支付宝首页,Fragment底部按钮切换和登录圆形头像

    此案例主要讲的是Android控件Gridview(九宫格)完美实现仿支付宝首页,包含添加和删除功能:Fragment底部按钮切换的效果,包含四个模块,登录页面圆形头像等,一个小项目的初始布局. 效果 ...

  7. Android 控件架构及View、ViewGroup的测量

    附录:示例代码地址 控件在Android开发的过程中是必不可少的,无论是我们在使用系统控件还是自定义的控件.下面我们将讲解一下Android的控件架构,以及如何实现自定义控件. 1.Android控件 ...

  8. Android控件属性大全(转)

    http://blog.csdn.net/pku_android/article/details/7365685 LinearLayout         线性布局        子元素任意: Tab ...

  9. UIAutomator定位Android控件的方法

    UIAutomator各种控件定位的方法. 1. 背景 使用SDK自带的NotePad应用,尝试去获得在NotesList那个Activity里的Menu Options上面的那个Add note菜单 ...

随机推荐

  1. 2017-12-26--mysql(5.6.15),linux下安装使用

    本文档的目的是,指导使用者安装.配置.还原所需要用到的mysql数据库.仅提供linux版本服务器的安装说明,且linux版本为64位的Centos6.4.同时,会提供的mysql安装包(MySQL- ...

  2. 面试-java反射

    问题:简述Java中的反射使用 答: 1.作用: 可以通过配置文件来动态配置和加载类,以实现软件工程理论里所提及的类与类,模块与模块之间的解耦.反射最经典的应用是spring框架. 2. 定义 反射简 ...

  3. markdown code test - markdown code test - markdown code test - markdown code test

    目录 主要代码 bottom cc 主要代码 <div class="tocCol1 js-toc"></div> <a>bc</a> ...

  4. go-switch特点

    程序中遇到有枚举分支逻辑时,需要用到 switch 代替多个 if else 判断. 学习过程遇到一些与C#不同点,记录下. 语法: switch expr { case x1 : //expr为x1 ...

  5. shell编程(五)之函数

    function:函数 函数只有被调用才会执行如何调用:给定函数名 函数名出现的地方,会被自动替换为函数代码 函数的生命周期:被调用时创建,返回时终止return命令返回自定义状态结果 0:成功 1- ...

  6. 【HNOI 2018】转盘

    Problem Description 一次小 \(G\) 和小 \(H\) 原本准备去聚餐,但由于太麻烦了于是题面简化如下: 一个转盘上有摆成一圈的 \(n\) 个物品(编号 \(1\) 至 \(n ...

  7. Luogu P1245 电话号码

    Luogu P1245 电话号码 谨以此题解致敬我的初中英语老师孙菡老师,她带的班默写不过的人数总是像电话号码那样屈指可数 玄学问题? 本题的SPJ似乎已经基本没有问题了,只要 文末没有多余的空格和回 ...

  8. 彻底搞懂Gradle、Gradle Wrapper与Android Plugin for Gradle的区别和联系

    首先用一段通俗易懂但是不是非常专业的话描述一下三者的概念.区别和联系. Gradle是个构建系统,能够简化你的编译.打包.测试过程.熟悉Java的同学,可以把Gradle类比成Maven. Gradl ...

  9. php日志

    // 全局通用日志工具 function setlog($param = [],$result = [],$name='',$filename = 'm.log',$path = '/tmp/bear ...

  10. HDU 5115 (杀狼,区间DP)

    题意:你是一个战士现在面对,一群狼,每只狼都有一定的主动攻击力和附带攻击力.你杀死一只狼.你会受到这只狼的(主动攻击力+旁边两只狼的附带攻击力)这么多伤害~现在问你如何选择杀狼的顺序使的杀完所有狼时, ...