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菜单 ...
随机推荐
- python模块的使用
这位老师的文章说的很清楚:模块 这里我只说一下,我在使用过程中的一些注意事项. 比如,我创建了一个包,该包下面有两个模块:model1和model2,如下图 那么我们再python中怎样去使用自己创建 ...
- 聊天斗图神器aidou mac中文版
aidou mac中文版是mac上一款专为斗图设计的聊天斗图神器,让您在聊天的时候不怕没有表情用,炫酷的表情即时更新,让您每时每刻都有新表情用!一键下载的表情包!小编现为您带来aidou斗图神器免费版 ...
- jvm启动参数设置 -Dfile.encoding=UTF-8 解决freemark乱码
今天一个spring boot应用windows跑起来后页面显示乱码,加上jvm启动参数为utf-8后,页面显示正常.
- GitHub 常用的几条命令
初始化仓库 git init 下载仓库 git clone 仓库地址 将所有违背跟踪的文件添加到本地仓库 git add . 查看状态 git status 执行提交 git commit -m pr ...
- 关于C#的Main(String[] args)参数输入问题
关于C#的Main(String[] args)参数输入问题 指定相关的测试代码 首先,写一个用于测试的关于Main(String[] args)参数输入有关的代码类,如下: using System ...
- Java实训作业1
1.编写程序:声明一个整型变量a,并赋初值5,在程序中判断a是奇数还是偶数,然后输出判断的结果 2.编写程序:从键盘输入圆的半径,计算圆的面积并输出. 3.编写程序:实现一个数字加密器.运行时输入加密 ...
- ES6 let const学习
1.let命令:用法类似于var,但是所声明的变量,只在let命令所在的代码块有效. 例:var a = [ ]; for(var i=0;i<10;i++){ a[ i ] = functio ...
- vue+vuex 回退定位到初始位置
先放出两张图(没错,你还在9012,做为一名资深设计师我唯一的技能点就是留白),简单说明下问题未做回退定位(从落地页回退,每次都回到A位置)想死啊有木有,每次都需要手动重新定位来选择,你大哥看到你做个 ...
- 2018-2019-2 20175317 实验二《Java面向对象程序设计》实验报告
2018-2019-2 20175317 实验二<Java面向对象程序设计>实验报告 一.实验步骤及内容 面向对象程序设计-1 参考 http://www.cnblogs.com/roce ...
- windows,用c++调用mxnet做前向
参考博客: https://blog.csdn.net/qq_34062105/article/details/82590553 https://blog.csdn.net/u012234115/ar ...