位置: 编程技术 - 正文

android中注册页面实现(android注册界面设计)

发布时间:2024-02-27

推荐整理分享android中注册页面实现(android注册界面设计),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:android用户注册界面设计步骤,android用户注册界面,android用户注册界面,android用户注册界面,android注册页面信息跳转显示,android注册页面信息跳转显示,android注册页面信息跳转显示,android注册界面设计,内容如对您有帮助,希望把文章链接给更多的朋友!

自己动手做的第一个demo,简单的注册页面的实现,并且注册成功后返回注册信息,适用于android新手基本控件的使用。

注册页面的实现:import android.os.Bundle;import android.app.Activity;import android.app.AlertDialog;import android.content.Intent;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.AdapterView;import android.widget.ArrayAdapter;import android.widget.AdapterView.OnItemSelectedListener;import android.widget.Button;import android.widget.CheckBox;import android.widget.CompoundButton;import android.widget.CompoundButton.OnCheckedChangeListener;import android.widget.EditText;import android.widget.RadioGroup;import android.widget.Spinner;import android.widget.ToggleButton;public class RegisterActivity extends Activity { private static final String places[] = {"中国","中国香港","中国台湾","中国澳门"}; private boolean isNotified = false; private int sexFlag = 0; private boolean isChecked = false; private int plcFlag = 0;@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_register);//设置标题setTitle("注册成功");//获取控件final EditText username = (EditText)findViewById(R.id.username);final EditText pwd = (EditText)findViewById(R.id.pwd);final EditText pwdrp = (EditText)findViewById(R.id.pwdrp);RadioGroup sex = (RadioGroup)findViewById(R.id.sex);Spinner from = (Spinner)findViewById(R.id.from);final EditText mail= (EditText)findViewById(R.id.mail);ToggleButton notify = (ToggleButton)findViewById(R.id.notify);CheckBox check = (CheckBox)findViewById(R.id.check);Button register = (Button)findViewById(R.id.register);Button cancel = (Button)findViewById(R.id.cancel);//给Spinner设置适配器ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_spinner_item,places);//设置下拉菜单样式adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);from.setAdapter(adapter);//事件监听notify.setOnCheckedChangeListener(new OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(CompoundButton arg0, boolean flag) {// TODO Auto-generated method stubisNotified = flag;}});check.setOnCheckedChangeListener(new OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(CompoundButton arg0, boolean flag) {// TODO Auto-generated method stubisChecked = flag;}});sex.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(RadioGroup arg0, int flag) {// TODO Auto-generated method stubsexFlag = flag;}});from.setOnItemSelectedListener(new OnItemSelectedListener() {@Overridepublic void onItemSelected(AdapterView<?> arg0,View arg1,int flag,long arg3){plcFlag = flag; }@Overridepublic void onNothingSelected(AdapterView<?> arg0) {// TODO Auto-generated method stub}});register.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View arg0) {// TODO Auto-generated method stubString strUser = username.getText().toString();String strPwd = pwd.getText().toString();String strPwdrp = pwdrp.getText().toString();String strMail = mail.getText().toString();if(strUser.equals("")){//弹出对话框new AlertDialog.Builder(RegisterActivity.this).setIcon(android.R.drawable.ic_dialog_alert).setTitle("警告").setMessage("请输入用户名").setPositiveButton("确定", null).show();return;}if(!strPwd.equals(strPwdrp)){//弹出对话框new AlertDialog.Builder(RegisterActivity.this).setIcon(android.R.drawable.ic_dialog_alert).setTitle("警告").setMessage("两次输入的密码不相同").setPositiveButton("确定", null).show();return;}if(!isChecked){//弹出对话框new AlertDialog.Builder(RegisterActivity.this).setIcon(android.R.drawable.ic_dialog_alert).setTitle("警告").setMessage("请勾选同意条款").setPositiveButton("确定", null).show();return;}//发送数据到另一个ActivityBundle bundle = new Bundle();bundle.putString("username", strUser);bundle.putString("mail", strMail);bundle.putString("from", places[plcFlag]);//bundle.putString("from", "中国");bundle.putBoolean("notify", isNotified);bundle.putBoolean("check", isChecked);bundle.putInt("sex", sexFlag);Intent intent = new Intent(RegisterActivity.this,ResultActivity.class);intent.putExtra("info", bundle);//启动这个ActivityRegisterActivity.this.startActivity(intent);//结束本ActivityRegisterActivity.this.finish();}});cancel.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View arg0) {// TODO Auto-generated method stubRegisterActivity.this.finish();}});}@Overridepublic 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;}}

android中注册页面实现(android注册界面设计)

注册结果显示activity:

import android.os.Bundle;import android.app.Activity;import android.content.Intent;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.TextView;public class ResultActivity extends Activity {@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.registerresult);//设置标题setTitle("注册成功");//接收数据Intent intent = this .getIntent();Bundle bundle = intent.getBundleExtra("info");String strUsername = bundle.getString("username");String strMail = bundle.getString("mail");String strFrom = bundle.getString("from");String strNotify = bundle.getBoolean("notify") ? "是":"否";;String strSex = bundle.getInt("sexFlag") == 0 ? "男":"女";;TextView username = (TextView)findViewById(R.id.username);username.setText(strUsername);TextView mail = (TextView)findViewById(R.id.mail);mail.setText(strMail);TextView from = (TextView)findViewById(R.id.from);from.setText(strFrom);TextView notify = (TextView)findViewById(R.id.notify);notify.setText(strNotify);TextView sex = (TextView)findViewById(R.id.sex);sex.setText(strSex);Button doneBt = (Button)findViewById(R.id.done);doneBt.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View arg0) {// TODO Auto-generated method stubResultActivity.this.finish();}});}@Overridepublic 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;}}

XML文件:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center"> <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center"> <TableRow android:layout_height="wrap_content" android:gravity="center"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="用户名"/> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@&#;id/username"/> </TableRow> <TableRow android:layout_height="wrap_content" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="密码"/> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@&#;id/pwd" android:inputType="textPassword"/> </TableRow> <TableRow android:layout_height="wrap_content" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="确认密码"/> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@&#;id/pwdrp" android:inputType="textPassword"/> </TableRow> <TableRow android:layout_height="wrap_content" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="性别"/> <RadioGroup android:id="@&#;id/sex" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <RadioButton android:id="@&#;id/male" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="男"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" "/> <RadioButton android:id="@&#;id/famale" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="女"/> </RadioGroup> </TableRow> <TableRow android:layout_height="wrap_content" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="来自"/> <Spinner android:id="@&#;id/from"android:layout_width="dp"android:layout_height="dp"/> </TableRow> <TableRow android:layout_height="wrap_content" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="邮箱地址"/> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@&#;id/mail" android:inputType="textEmailAddress"/> </TableRow> <TableRow android:layout_height="wrap_content" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="邮件通知"/> <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <ToggleButton android:id="@&#;id/notify" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="toggleButton"/> </FrameLayout> </TableRow> <TableRow android:layout_height="wrap_content" android:gravity="center"> <CheckBox android:id="@&#;id/check" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="同意条款"/> </TableRow> </TableLayout> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center"> <Button android:id="@&#;id/register" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 注册 "/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" "/> <Button android:id="@&#;id/cancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 取消 "/> </LinearLayout></LinearLayout>

Android酷炫实用的开源框架(UI框架)(转载,只为保存) 转自Android开发中文站»Android酷炫实用的开源框架(UI框架),点击打开链接。转载该博客,只为保存,留下自己慢慢体验。1.Side-Menu.Android分类侧滑菜单

Android 匿名启动activity 启动系统activity 一般我们使用Intent进行activity跳转时我们都知道需要跳转的activity的名字,例如:Intentintent=newIntent(FirstActivity.this,SecondActitivy.class);startActivity(intent);当SecondA

Andorid学习之路(七)之 Serializable接口和Parcelable接口 Activity之间的数据传输activity之间的数据传输我们可以通过Intent对象的putExtra方法,通过这个可以传输很多不同类型的数据,比如说字符串、整数、实数

标签: android注册界面设计

本文链接地址:https://www.jiuchutong.com/biancheng/374483.html 转载请保留说明!

上一篇:Android之Volley

下一篇:Android酷炫实用的开源框架(UI框架)(转载,只为保存)(安卓炫酷壁纸)

  • 递延所得税负债转回怎么理解
  • 上级补助收入支出决算科目
  • 未实际收到的投资收益要纳税调整吗
  • 股东退股如何清算表格
  • 减免税控盘增值税纳税申报
  • 建筑施工企业销售费用包括哪些
  • 出口退税没有进项就退不了税吗?
  • 当月支付租金没有发票
  • 工资表不给看
  • 事业单位的出纳要承担的责任是什么
  • 公司聚餐一定要去吗
  • 资产负债表和业务活动表勾稽关系不对怎么查
  • 个税申报系统在哪里撤销更正
  • 企业向境外支付货款填写
  • 销售人员差旅费管理办法
  • 个人税收起征点调整
  • 免租金期间交增值税吗
  • 预收账款税收政策
  • 原材料实际成本法核算问题
  • 化工厂危险废物种类以及处置方式
  • 斐讯路由器地址在哪里看
  • 诊所免税政策
  • 收到退回付款货款
  • 库存股属于什么项目
  • vue3+vite在main.ts或者main.js文件中引入/App.vue报错(/App.vue不是模块)
  • 直接将word转化为ppt
  • 机动处置什么意思
  • 购买股票的佣金计入
  • 含工资表的会计科目
  • php 写入excel
  • 预收账款和应收账款的转换
  • php输出语法
  • vue前端框架搭建
  • 报税扣款锁定怎么处理
  • 数据库查询框架
  • dedecms怎么用
  • sql执行顺序优先级
  • pandas columns排序
  • 企业期末预收账款怎么算
  • 专家劳务费能否抵扣个税
  • 支付宝商户服务电话
  • 开具免税的发票,"税率"栏如何填开?
  • 残疾人就业相关论文题目
  • 水电费 会计
  • 企业运费如何开票
  • 什么叫公关费用
  • 增加固定资产原值后折旧
  • 勾选认证能够勾选当月
  • 公司在建厂房图片大全
  • 本月留抵增值税
  • 提取公积金收手续费吗
  • 在建工程什么时候用
  • 外贸公司出口退税进项发票没及时开票有影响吗
  • 预收账款核算如何做账
  • 现金存入银行凭证怎么写
  • 签合同的名称和内容
  • 长期股权投资其他权益变动
  • 软件开发过程中,一个错误发现的越晚
  • 技术人员工资条
  • 一般纳税人月底进项税销项税怎么做分录
  • 发票勾选认证成功了是不是就可以抵扣呀
  • mysql查询包含
  • 动态sql语句怎么写
  • centos操作命令
  • webcamrt.exe - webcamrt 进程是什么意思
  • win7旗舰版系统激活码
  • win10怎么把中文系统改成英文
  • xp无法启动如何修复
  • win10每次开机提示硬件设置已更改
  • windows10总是弹出用户账户控制
  • 关于减肥的好方法
  • php 时间差
  • linux百度网盘安装
  • javascript的对象
  • 销售车位需要交房产税吗
  • 江苏电子税务局社保缴费打印
  • 安徽省国家税务局通用定额发票
  • 残疾人保障金如何填报
  • 陈列费发票能抵扣吗
  • 北京的个人所得税怎么算
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号