初步用户注册页面(更新)

对上一篇的更新完善

1.基于上一篇,注册页面内容多的话需加一个滚动条使其完全显示:只要用ScrollView把之前的嵌套进去就ok了。

2.对于activity类,只要稍作改动,获取信息,在提示框中就能显示登录者的全部信息(上一篇划线处):

public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		nameInput1 = (EditText) this.findViewById(R.id.name);
		clickbutton = (Button) this.findViewById(R.id.click);
		radioButton1 = (RadioButton) findViewById(R.id.radioButton1);
		radioButton2 = (RadioButton) findViewById(R.id.radioButton2);
		datePicker1 = (DatePicker) findViewById(R.id.datePicker1);
		checkBox1 = (CheckBox) findViewById(R.id.checkBox1);
		checkBox2 = (CheckBox) findViewById(R.id.checkBox2);
		game = (CheckBox) findViewById(R.id.game);
		basketball = (CheckBox) findViewById(R.id.basketball);

		clickbutton.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				String name = nameInput1.getText().toString();
				String sex = "";
				if (radioButton1.isChecked()) {
					sex = "男";
				}
				if (radioButton2.isChecked()) {
					sex = "女";
				}
				String date = datePicker1.getYear() + "年"
						+ datePicker1.getMonth() + "月"
						+ datePicker1.getDayOfMonth() + "日";
				String hobby = "";
				if (checkBox1.isChecked()) {
					hobby = hobby + "," + checkBox1.getText();
				}
				if (basketball.isChecked()) {
					hobby = hobby + "," + basketball.getText();
				}
				if (game.isChecked()) {
					hobby = hobby + "," + game.getText();
				}
				if (checkBox2.isChecked()) {
					hobby = hobby + "," + checkBox2.getText();
				}
				Toast.makeText(
						MainActivity.this,
						"注册成功!\n您的姓名:" + name + "\n您的性别是:" + sex + "\n您的生日是:"
								+ date + "\n您的爱好:" + hobby, Toast.LENGTH_LONG)
						.show();
			}

		});

	}


至此,注册页面算是完全无误的显示了。可能会有简化,到时再做总结。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值