设计用户注册页面
来源:互联网 发布:vb中val是什么意思 编辑:程序博客网 时间:2024/04/28 13:19
设计用户注册页面知识点:
掌握以下UI组件的使用
CheckBox用于选取多个值时使用的组件,在布局文件中使用<CheckBox>标签标记,可以使用android:checked=“true”来设定默认选中值。
DatePicker组件可以输入日期。范围在1900-1-1 ~ 2100-12-31
RadioButton可以构建一组单选按钮,一组互斥的单选按钮必须在用一个RadioGroup中。
Toast:弹出提示框
ScrollView的使用:当一屏显示不开时,自动加入滚动条,此时布局文件中ScrollView处于顶级元素
CheckBox用于选取多个值时使用的组件,在布局文件中使用<CheckBox>标签标记,可以使用android:checked=“true”来设定默认选中值。
DatePicker组件可以输入日期。范围在1900-1-1 ~ 2100-12-31
RadioButton可以构建一组单选按钮,一组互斥的单选按钮必须在用一个RadioGroup中。
Toast:弹出提示框
ScrollView的使用:当一屏显示不开时,自动加入滚动条,此时布局文件中ScrollView处于顶级元素
运行效果图:
注册页面的布局文件
<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/label_name" /> <EditText android:id="@+id/name" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/label_sex" /> <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="@string/male" /> <RadioButton android:id="@+id/female" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/female" /> </RadioGroup> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/label_birth" /> <DatePicker android:id="@+id/birth" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/label_interest" /> <CheckBox android:id="@+id/movie" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/movie" /> <CheckBox android:id="@+id/basketball" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/basketball" /> <Button android:id="@+id/submit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_submit" > </Button> </LinearLayout></ScrollView>
注册成功时弹出注册信息
public class RegisterActivity extends Activity {/** Called when the activity is first created. */@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);final EditText nameText = (EditText) this.findViewById(R.id.name);final RadioButton maleRadio = (RadioButton) this.findViewById(R.id.male);final RadioButton femaleRadio = (RadioButton) this.findViewById(R.id.female);final DatePicker birthDatePicker = (DatePicker) this.findViewById(R.id.birth);final CheckBox movieBox = (CheckBox) this.findViewById(R.id.movie);final CheckBox basketballBox = (CheckBox) this.findViewById(R.id.basketball);Button submit = (Button) this.findViewById(R.id.submit);submit.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {String sex = "男";if (maleRadio.isChecked()) {sex = maleRadio.getText().toString();}if (femaleRadio.isChecked()) {sex = femaleRadio.getText().toString();}String interest = "";if (movieBox.isChecked()) {interest = interest + movieBox.getText().toString();}if (basketballBox.isChecked()) {interest = interest + basketballBox.getText().toString();}String birth = birthDatePicker.getYear() + "年"+ (birthDatePicker.getMonth() + 1) + "月"+ birthDatePicker.getDayOfMonth() + "日";StringBuffer prompt = new StringBuffer();prompt.append("注册成功!\n您的姓名:").append(nameText.getText().toString()).append("\n您的性别是:").append(sex).append("\n您的生日:").append(birth).append("\n您的爱好:").append(interest);Toast.makeText(RegisterActivity.this, prompt, Toast.LENGTH_LONG).show();}});}}
- 设计用户注册页面
- 用户注册页面设计
- 设计用户注册页面(常用组件的应用)
- 如何设计出用户体验良好的登录/注册页面
- 如何设计出用户体验良好的登录/注册页面
- 初步用户注册页面
- H5 用户注册页面
- 用户注册页面
- 注册页面设计
- 如何制作用户注册页面
- bbs用户注册页面源码
- 用户注册页面<城市级联>
- 用户注册页面的实现
- 设计一个用户注册程序
- Axure设计登录注册页面
- paip.提升用户体验-----用户注册设计
- 注册一个用户控件到aspx页面
- Drupal 6 自定义用户登陆、注册页面
- Axis2生成的客户端代码须依赖的Axis2的jars
- VS2008常见错误
- 蝴蝶兰与鳞托菊
- 机器学习中的数学(1)-回归(regression)、梯度下降(gradient descent)
- HDFS-RAID使用Erasure Code来实现HDFS的数据冗余
- 设计用户注册页面
- 念,心随君浅舞天涯
- 黑马程序员——一般处理程序(1)
- jquery uploadify的JS用法以及JAVA类的用法
- AMPL 个人投资线性规划问题
- IE中使用google的搜索程序时总是先弹出“查看在google.com.hk上的搜索结果”页面,如何让其直接返回搜索结果?
- poj 2250 (LCS 需打印路径)
- 通过flashback命令回撤Oracle中误操作的Dml命令
- Android Animations动画使用详解