android控件基本布局
<?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.myhyx.MainHyx"> <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"
/> <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" /> </RelativeLayout>
//实现男、女的单选控件
<?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"> <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> <View
android:id="@+id/View8"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#999999"
android:layout_below="@+id/radioGroup2"
/>
<RadioGroup

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控件基本布局的更多相关文章
- 探究android控件及布局
控件(widget) 1. TextView(该控件的一些需要注意的属性,下同) gravity="center"textSize="24sp"textColo ...
- Android 控件在布局中按比例放置[转]
转自:http://netsky1990.blog.51cto.com/2220666/997452 在Android开发中常用到线性布局LinearLayout对界面进行具体的创建,其中 ...
- Android 手机卫士--自定义组合控件构件布局结构
由于设置中心条目中的布局都很类似,所以可以考虑使用自定义组合控件来简化实现 本文地址:http://www.cnblogs.com/wuyudong/p/5909043.html,转载请注明源地址. ...
- Android编程 控件与布局
控件和布局的继承结构 常用控件 1.TextView <?xml version="1.0" encoding="utf-8"?> <Line ...
- Android 控件属性介绍
1.LinearLayout(线性布局): 可以分为水平线性:android:orientation= " horizontal " 和垂直线性:android:orientati ...
- Android控件Gridview实现仿支付宝首页,Fragment底部按钮切换和登录圆形头像
此案例主要讲的是Android控件Gridview(九宫格)完美实现仿支付宝首页,包含添加和删除功能:Fragment底部按钮切换的效果,包含四个模块,登录页面圆形头像等,一个小项目的初始布局. 效果 ...
- Android 控件架构及View、ViewGroup的测量
附录:示例代码地址 控件在Android开发的过程中是必不可少的,无论是我们在使用系统控件还是自定义的控件.下面我们将讲解一下Android的控件架构,以及如何实现自定义控件. 1.Android控件 ...
- Android控件属性大全(转)
http://blog.csdn.net/pku_android/article/details/7365685 LinearLayout 线性布局 子元素任意: Tab ...
- UIAutomator定位Android控件的方法
UIAutomator各种控件定位的方法. 1. 背景 使用SDK自带的NotePad应用,尝试去获得在NotesList那个Activity里的Menu Options上面的那个Add note菜单 ...
随机推荐
- JSP等模板引擎已死,大前端为趋势
我们先来看一下tomcat版本数据: 我们可以看到,从tomcat8之后JSP就再没有新的支持了,tomcat8大概是2013年发布的,也就是说,从2013年开始jsp技术已经实质上不被官方继续维护了 ...
- opencv学习之路(41)、人脸识别
一.人脸检测并采集个人图像 //take_photo.cpp #include<opencv2/opencv.hpp> using namespace cv; using namespac ...
- Raphael.js--基础1
Raphael.js 特点: 1.兼容VML和SVG 2.扩展功能——动画 用法: //1.创建画布 let paper=Raphael(x,y,width,height); //2.创建形状 let ...
- linux下 如何切换到root用户
默认安装完成之后并不知道root用户的密码,那么如何应用root权限呢? (1)sudo 命令 xzm@ubuntu:~$ sudo 这样输入当前管理员用户密码就可以得到超级用户的权限.但默认的情况 ...
- vscode打开django项目pylint提示has not "object" member
vscode 打开 django 项目提示 has not "object" member 是因为 Django 动态地将属性添加到所有模型类中,所以 ide 无法解析. 解决方案 ...
- CSS之不常用但重要的样式总结
1,设置颜色渐变 background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.67), rgba(255, 255, 255, 0));( ...
- OpenGL.Tutorial15_Lightmaps
ZC:撤销 & 重做 — Blender Manual.html(https://docs.blender.org/manual/zh-hans/dev/interface/undo_redo ...
- 初学spring笔记
简单hello world 项目,了解IOC 反转控制
- 如何增加亚马逊listing多个类目节点
流量是电商销售的必要因素,可以说,任何成功的电商平台都离不开流量.亚马逊listing优化做得好,不仅能提高产品的曝光率,还能提升转换率,而好的类目可以吸引大的流量.帮你快速爬升. 首先我们来了解一下 ...
- WIN10下Java环境变量配置
首先,你应该已经安装了 Java 的 JDK 了(如果没有安装JDK,请跳转到此网址:http://www.oracle.com/technetwork/java/javase/downloads/i ...