Android--普通注册页面实现(无功能)
reg.xml
<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=".RegisterActivity" > <TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" /> <TextView
android:id="@+id/tvUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_alignTop="@+id/textView2"
android:text="用户名" /> <TextView
android:id="@+id/tvPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_below="@+id/textView2"
android:layout_marginTop="16dp"
android:text="密码" /> <RadioGroup
android:id="@+id/rdSex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/tvPassword"
android:layout_below="@+id/etPassword"
android:layout_marginTop="22dp" > <RadioButton
android:id="@+id/man"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="男" /> <RadioButton
android:id="@+id/woman"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/rdSex"
android:layout_centerHorizontal="true"
android:text="女" />
</RadioGroup> <CheckBox
android:id="@+id/cb_hb_std"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/rdSex"
android:layout_below="@+id/rdSex"
android:layout_marginTop="30dp"
android:text="学习" /> <TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/cb_hb_photo"
android:layout_alignLeft="@+id/cb_hb_std"
android:text="爱好" /> <TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/cb_hb_std"
android:layout_below="@+id/cb_hb_std"
android:layout_marginTop="19dp"
android:text="年龄" /> <Spinner
android:id="@+id/spinnerAge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView4"
android:layout_below="@+id/textView4"
android:layout_marginTop="23dp" /> <ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/cb_hb_slp"
android:layout_alignTop="@+id/spinnerAge"
android:src="@drawable/ic_launcher" /> <ProgressBar
android:id="@+id/pb"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView3"
android:layout_toLeftOf="@+id/cb_hb_slp"
android:visibility="gone" /> <Button
android:id="@+id/btnCon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/spinnerAge"
android:layout_alignParentBottom="true"
android:text="确认" /> <CheckBox
android:id="@+id/cb_hb_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView4"
android:layout_alignRight="@+id/etRegUsername"
android:layout_marginRight="44dp"
android:text="摄影" /> <CheckBox
android:id="@+id/cb_hb_slp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView4"
android:layout_marginRight="18dp"
android:layout_toLeftOf="@+id/cb_hb_photo"
android:text="睡觉" /> <TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/rdSex"
android:layout_below="@+id/etPassword"
android:text="性别" /> <EditText
android:id="@+id/etRegUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/tvUsername"
android:layout_toRightOf="@+id/cb_hb_std"
android:ems="10" > <requestFocus />
</EditText> <EditText
android:id="@+id/etPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/tvPassword"
android:layout_alignBottom="@+id/tvPassword"
android:layout_alignLeft="@+id/etRegUsername"
android:layout_alignRight="@+id/etRegUsername"
android:ems="10"
android:inputType="textPassword" /> </RelativeLayout>
regSucc.xml
<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=".RegSuccActivity" > <TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" /> <TextView
android:id="@+id/cfName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_alignTop="@+id/textView2"
android:text=" 1" /> <TextView
android:id="@+id/cfSex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_below="@+id/textView2"
android:text="TextView" /> <TextView
android:id="@+id/cfHobby"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/cfSex"
android:layout_below="@+id/cfSex"
android:layout_marginTop="28dp"
android:text="TextView" /> <TextView
android:id="@+id/cfSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/cfHobby"
android:layout_below="@+id/cfHobby"
android:layout_marginTop="33dp"
android:text="TextView" /> </RelativeLayout>
RegiserActivity.java
public class RegisterActivity extends Activity {
private EditText etRegUsername;
private RadioGroup rgSex;
private Button btnCon;
private Spinner spinnerAge;
private ProgressBar pb;
private CheckBox cb1;
private CheckBox cb2;
private CheckBox cb3;
private List<CheckBox> checkBoxList = new ArrayList<CheckBox>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
List<String> listAge=new ArrayList<String>();
listAge.add("18");
listAge.add("19");
listAge.add("20");
listAge.add("21");
spinnerAge=(Spinner)this.findViewById(R.id.spinnerAge);
ArrayAdapter adapterAge=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,listAge);
adapterAge.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerAge.setAdapter(adapterAge);
btnCon=(Button)this.findViewById(R.id.btnCon);
pb=(ProgressBar)this.findViewById(R.id.pb);
rgSex=(RadioGroup)findViewById(R.id.rdSex);
etRegUsername=(EditText)findViewById(R.id.etRegUsername);
cb1=(CheckBox)findViewById(R.id.cb_hb_slp);
cb2=(CheckBox)findViewById(R.id.cb_hb_std);
cb3=(CheckBox)findViewById(R.id.cb_hb_photo);
checkBoxList.add(cb1);
checkBoxList.add(cb2);
checkBoxList.add(cb3);
btnCon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
pb.setVisibility(View.VISIBLE);
Toast.makeText(RegisterActivity.this, "success", Toast.LENGTH_LONG).show();
Intent itRegSuc=new Intent(RegisterActivity.this,RegSuccActivity.class);
String hb =" ";
for (CheckBox checkbox : checkBoxList) {
if (checkbox.isChecked()){
hb+=checkbox.getText().toString() + " ";
}
}
String name=etRegUsername.getText().toString();
// Bundle bundle=new Bundle();
// //传递name参数为tinyphp
// bundle.putString("name", name);
// itRegSuc.putExtras(bundle);
RadioButton rbSex=(RadioButton)findViewById(rgSex.getCheckedRadioButtonId());
String sex=rbSex.getText().toString();
String sp=(String)spinnerAge.getSelectedItem();
itRegSuc.putExtra("name", name);
itRegSuc.putExtra("sex", sex);
itRegSuc.putExtra("hobby", hb);
itRegSuc.putExtra("spinner", sp);
startActivity(itRegSuc);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.register, menu);
return true;
}
}
RegSuccActivity.java
public class RegSuccActivity extends Activity {
private TextView cfName;
private TextView cfSex;
private TextView cfHobby;
private TextView cfSpinner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rsg_succ);
// Bundle bundle = this.getIntent().getExtras();
// String name=bundle.getString("name");
Intent it=getIntent();
String name=it.getStringExtra("name");
String sex=it.getStringExtra("sex");
String hb=it.getStringExtra("hobby");
String spinner=it.getStringExtra("spinner");
cfName=(TextView)findViewById(R.id.cfName);
cfSex=(TextView)findViewById(R.id.cfSex);
cfSpinner=(TextView)findViewById(R.id.cfSpinner);
cfHobby=(TextView)findViewById(R.id.cfHobby);
cfName.setText(name);
cfSex.setText(sex);
cfHobby.setText(hb);
cfSpinner.setText(spinner);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.rsg_succ, menu);
return true;
}
}
Android--普通注册页面实现(无功能)的更多相关文章
- Android之注册界面练习
今天要分享的是一个安卓注册小练习,记录一下自己的学习. 做一个注册页面. 要求填入用户如下信息: 用户名.密码.确认密码.性别(单选).爱好(多选,包括至少六个选项,如音乐.美术.阅读.篮球等).em ...
- .Net程序猿乐Android开发---(4)注册页面布局
接下来我们介绍的登陆页面布局,在本节中,我们看一下注册页面布局,页面布局大同小异,来一起熟悉下基本控件的使用方法. 效果图: 1.加入注冊页面 右键选中layout目录,加入注冊页面.例如以下图 点击 ...
- Android笔记-4-实现登陆页面并跳转和简单的注册页面
实现登陆页面并跳转和简单的注册页面 首先我们来看看布局的xml代码 login.xml <span style="font-family:Arial;font-size:18px; ...
- Android程序员学WEB前端(4)-HTML(4)-注册页面-Sublime
转载请注明出处:http://blog.csdn.net/iwanghang/article/details/76576031 觉得博文有用,请点赞,请评论,请关注,谢谢!~ 注册页面1: <! ...
- Android 开启 WebView 页面 Chrome debug
Android 开启 WebView 页面 Chrome debug WebView debug // 开启 WebView 页面 debug testWebView.setWebContentsDe ...
- php登录注册页面及加载
php注册界面 <h1>注册页面</h1> <form acti ...
- php做登录注册页面及加载
//SQL注入攻击 //1.过滤用户的输入 //2.使用预处理语句 //3.写代码的时候尽量避免 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1. ...
- 使用jQuery开发一个带有密码强度检验的超酷注册页面
在今天的jQuery教程中,我们将介绍如何使用jQuery和其它相关的插件来生成一个漂亮的带有密码强度检验的注册页面,希望大家喜欢! 相关的插件和类库 complexify - 一个密码强度检验jQu ...
- 如何在nopcommerce3.3注册页面添加密码强度检查仪?
我刚刚完成了nopCommerce注册页面的密码强度检查仪,因为我觉得在电子商务交易平台,安全问题是非常重要的.在注册页面有必要添加一个密码强度检测仪,以便通知用户他们的密码是否足够强大.今天,大多数 ...
- 注册页面的简单搭建(H5)
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
随机推荐
- Java 8后的首个长期支持版本Java 11
Java 11是Java8后的首个长期支持版本.按照 Oracle 公布的支持路线图,Java 11 将会获得 Oracle 提供的长期支持服务,直至2026年9月. 按照官方的说法,新的发布周期会严 ...
- MySQL 遇到错误集锦
MySQL 规定:varchar必须指定长度,否则报错:ERROR 1064 (42000) 只有一列时,primary key 直接写在这一列的后面: 没有定义主键时,提示错误:ERROR 1075 ...
- 六、springboot(三)配置双数据源
1.目录结构 2.jdbc.properties配置 #db houge spring.datasource.houge.jdbc-url=jdbc:oracle:thin:@:ORCL spring ...
- Spring Cloud Feign Ribbon 配置
由于 Spring Cloud Feign 的客户端负载均衡是通过 Spring Cloud Ribbon 实现的,所以我们可以直接通过配置 Ribbon 的客户端的方式来自定义各个服务客户端调用的参 ...
- 性能优化之永恒之道(实时sql优化vs业务字段冗余vs离线计算)
在项目中,随着时间的推移,数据量越来越大,程序的某些功能性能也可能会随之下降,那么此时我们不得不需要对之前的功能进行性能优化.如果优化方案不得当,或者说不优雅,那可能将对整个系统产生不可逆的严重影响. ...
- driftnet 抓取图片总结
语法: driftnet [options] [filter code] 主要参数: -b 捕获到新的图片时发出嘟嘟声 -i interface 选择监听 ...
- VS中生成时“sgen.exe”已退出,代码为 1解决办法
visual studio 2010 选定web项目,右键选择“属性”—“生成”,将“生成序列化程序集”设成“关闭”. 原理分析: sgen是XML序列化程序生成器工具. 可能是这个项目里面有xml序 ...
- MVC+linq开发经验
1.Though it is a mass,it will help you out of another mass,so,be glad to face it. 2.吃自己的狗粮.系统像一个房子,一 ...
- PPT资源
PPT模板下载:www.1ppt.com/moban/ 行业PPT模板:www.1ppt.com/hangye/ 节日PPT模板:www.1ppt.com/jieri/ PPT素材下载:www.1pp ...
- CAD 中绘制点
首先开启点样式,否则点是看不到的 系统变量 PDMODE 和 PDSIZE 控制点对象的显示外观. PDMODE 取值为 0.2.3 .4 时指定表示点的图形,取值为 1 表示不显示任何图形,如下图所 ...