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> ...
随机推荐
- 我发起了一个 .Net Core 平台上的 分布式缓存 开源项目 ShareMemory 用于 取代 Redis
Redis 的 安装 是 复杂 的, 使用 是 复杂 的, Redis 的 功能 是 重型 的, Redis 本身的 技术实现 是 复杂 的 . Redis 是用 C 写的, C 语言 编写的代码需要 ...
- day01 计算机的基础知识
1.编程语言: 人与计算机沟通的表达方式. 2.编程: 程序员用计算机能理解的表达方式(编程语言)把程序员想让计算机实现的功能写到文件里,这些文件称之为程序. 3.计算机硬件组成: 控制器:是计算机的 ...
- MySQL之 从复制延迟问题排查
一.从库复制延迟问题 1.可能的原因如下(1)主从服务器处于不同的网络之中,由于网络延迟导致:(2)主从服务器的硬件配置不同,从服务器的硬件配置(包括内存,CPU,网卡等)远低于主服务器:(3)主库上 ...
- TypeScript 之 JSX
https://m.runoob.com/manual/gitbook/TypeScript/_book/doc/handbook/JSX.html JSX中,类型断言必须使用as操作符. 类型检查 ...
- 六、springboot(三)配置双数据源
1.目录结构 2.jdbc.properties配置 #db houge spring.datasource.houge.jdbc-url=jdbc:oracle:thin:@:ORCL spring ...
- IDEA各个版本激活(亲测有效,永久有效)(转)
之前使用的license server 老是失效,今天又失效了,于是乎,在强大的网上找到了永久激活的方式,有个网站专门提供注册码,但是很这激活码有一定的期限,到期之后再获取一次即可,灰常方便. 激活方 ...
- 代码问题: 【MatConvNet库编译】
问题1: 老版本的MatConvNet在编译对cuDNN支持的时候,cuDNN的版本是2或者4比较好,官网有明确的描述. 比如我编译用了cuDNN 6.0的版本,在编译 nnconv_cudnn.cu ...
- Eclipse安装插件的“最好方法”:dropins文件夹的妙用
在Eclipse3.4以前安装插件非常繁琐. 在Eclipse3.5以后插件安装的功能做了改进.而且非常方便易用. 我们只需要把需要的插件复制(拖放)到eclipse\dropins,然后插件就安装成 ...
- WebService发布到IIS
发布WebService 第一步:选择项目右键发布 第二步:选择文件系统.目标位置(即,发布后文件保存位置) 单击发布 将WebService发布至IIS 第一步:打开IIS 右键添加网站--填写网站 ...
- Azure SQL 数据库仓库Data Warehouse (2) 架构
<Windows Azure Platform 系列文章目录> 在上一篇文章中,笔者介绍了MPP架构的基本内容 在本章中,笔者给大家介绍一下Azure SQL Data Warehouse ...