用Android写注册界面
来源:互联网 发布:乐视手机移动网络设置 编辑:程序博客网 时间:2024/06/05 21:58
LinearLayout 控制布局
TextView用于显示文字
EditText输入框
RadioGroup单选按钮和RadioButton一起用
CheckBox复选框
Spinner下拉框
源码:
register.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="6dp" android:layout_marginTop="10dp" android:text="用户名:" android:textSize="15dp" android:textColor="@color/colorPrimary" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="6dp" android:layout_marginTop="10dp" android:hint="输入2-10个字符" android:textColor="@color/colorPrimary" android:layout_weight="1"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="6dp" android:layout_marginTop="10dp" android:text="密码: " android:textSize="15dp" android:textColor="@color/colorPrimary" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="6dp" android:layout_marginTop="10dp" android:hint="输入6-10个字符" android:textColor="@color/colorPrimary" android:layout_weight="1"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="6dp" android:layout_marginTop="23dp" android:text="性别选择: " android:textSize="15dp" android:textColor="@color/colorPrimary" /> <RadioGroup android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginLeft="10dp" android:layout_marginTop="10dp"> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="30dp" android:layout_marginTop="6dp" android:text="男"/> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="30dp" android:layout_marginTop="6dp" android:text="女"/> </RadioGroup> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginTop="6dp" android:textSize="15dp" android:text="爱好选择:" android:textColor="@color/colorPrimaryDark"/> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6dp" android:layout_marginLeft="20dp" android:text="游泳"/> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6dp" android:layout_marginLeft="20dp" android:text="打球"/> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6dp" android:layout_marginLeft="20dp" android:text="看书"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginTop="6dp" android:textSize="15dp" android:text="所在地"/> <Spinner android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6dp" android:layout_marginLeft="10dp" android:entries="@array/citys"> </Spinner> </LinearLayout> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="注册" android:textColor="@color/colorPrimaryDark"/></LinearLayout>
strings.xml
<resources> <string name="app_name">Register</string> <string-array name="citys"> <item>赣州</item> <item>上海</item> <item>广州</item> <item>深圳</item> <item>北京</item> <item>湖南</item> <item>湖北</item> <item>南宁</item> <item>厦门</item> </string-array></resources>
Main.java
package com.example.hsy.register;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.register); }}
效果图
阅读全文
0 0
- 用Android写注册界面
- php写注册界面
- 用ASP.NET写的一个注册界面
- 用html写一个简短的员工注册界面
- android毕业设计-注册界面
- android 用户注册界面
- 使用HTML/CSS写注册界面
- 用lua写Android界面学习笔记
- android安装时注册界面
- android 简易的注册界面
- android UI注册登录界面
- 用ASP.NET连接数据库写的一个登陆注册界面
- 用Jsp+Servlet+JavaBean写的注册登陆界面,解决中文乱码
- 写android界面的感悟
- 写一个 android launcher界面
- 第一天学html写了个注册界面
- Java web 写一个注册登录界面,Sql 10
- mysql+phpstrom10.04写一个简单登录注册界面
- 62岁的她出演16岁少女, 现进军微商当网红!
- Oralce:远程连接数据库ORA-12638
- JSON 教程
- UNIX环境编程学习笔记(25)——信号处理进阶学习之 sigaction 函数
- spring boot中使用JdbcTemplate
- 用Android写注册界面
- IRP数据的传输方式,对应彭荣
- Python时间序列LSTM预测系列教程(2)-单变量
- django学习(二)之分页、vue.js数据绑定及模态对话框的使用
- python相关的安装指南
- Mariadb安装
- Spring之WebSocket网页聊天以及服务器推送
- 数学建模(9)——霍夫(Hough)变换圆检测
- HDU1950[Bridging signals] LIS模型 (nlogn)