欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

android實(shí)現(xiàn)注冊(cè)頁面開發(fā)

 更新時(shí)間:2022年04月24日 09:16:42   作者:我喜歡玩洛克王國  
這篇文章主要為大家詳細(xì)介紹了android實(shí)現(xiàn)注冊(cè)頁面開發(fā),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了android實(shí)現(xiàn)注冊(cè)頁面開發(fā)的具體代碼,供大家參考,具體內(nèi)容如下

在values文件里創(chuàng)建以下幾個(gè)文件

colors代碼:

<?xml version="1.0" encoding="utf-8"?>
<resources>
? ? <color name="purple_200">#FFBB86FC</color>
? ? <color name="purple_500">#FF6200EE</color>
? ? <color name="purple_700">#FF3700B3</color>
? ? <color name="teal_200">#FF03DAC5</color>
? ? <color name="teal_700">#FF018786</color>
? ? <color name="black">#FF000000</color>
? ? <color name="white">#FFFFFFFF</color>
</resources>

strings代碼塊

<resources>
? ? <string name="app_name">19260234anzidawang</string>
</resources>

修改為自己的學(xué)號(hào)

styles代碼

<?xml version="1.0" encoding="utf-8"?>
<resources>
? ? <style name="hLine">
? ? ? ? <item name="android:layout_width">match_parent</item>
? ? ? ? <item name="android:layout_height">1dp</item>
? ? ? ? <item name="android:background">@android:color/white</item>
? ? </style>
? ? <style name="vLine">
? ? ? ? <item name="android:layout_width">1dp</item>
? ? ? ? <item name="android:layout_height">match_parent</item>
? ? ? ? <item name="android:background">@android:color/white</item>
? ? </style>
? ? <style name="tvone">
? ? ? ? <item name="android:layout_height">match_parent</item>
? ? ? ? <item name="android:layout_width">0dp</item>
? ? ? ? <item name="android:layout_weight">1</item>
? ? ? ? <item name="android:drawablePadding">8dp</item>
? ? ? ? <item name="android:gravity">center_horizontal</item>
? ? ? ? <item name="android:paddingTop">40dp</item>
? ? ? ? <item name="android:textColor">@android:color/white</item>
? ? ? ? <item name="android:textSize">15dp</item>
? ? </style>
? ? <style name="tvtwo">
? ? ? ? <item name="android:layout_width">wrap_content</item>
? ? ? ? <item name="android:layout_height">wrap_content</item>
? ? ? ? <item name="android:layout_marginLeft">20dp</item>
? ? ? ? <item name="android:textColor">@android:color/white</item>
? ? ? ? <item name="android:textSize">15dp</item>
? ? </style>
? ? <style name="etOne">
? ? ? ? <item name="android:layout_width">match_parent</item>
? ? ? ? <item name="android:layout_height">wrap_content</item>
? ? ? ? <item name="android:layout_marginLeft">30dp</item>
? ? ? ? <item name="android:background">@null</item>
? ? ? ? <item name="android:textColor">@android:color/white</item>

? ? </style>
</resources>

布局文件(activity_main)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
? ?xmlns:android="http://schemas.android.com/apk/res/android"
? ? android:layout_width="match_parent"
? ? android:layout_height="match_parent"
? ? android:background="@drawable/register_bg">
? ? <LinearLayout
? ? ? ? android:layout_width="match_parent"
? ? ? ? android:layout_height="match_parent"
? ? ? ? android:orientation="vertical">
? ? ? ? <TextView
? ? ? ? ? ? android:id="@+id/tv_title"
? ? ? ? ? ? android:layout_width="match_parent"
? ? ? ? ? ? android:layout_height="50dp"
? ? ? ? ? ? android:background="#01ceff"
? ? ? ? ? ? android:gravity="center"
? ? ? ? ? ? android:text="注冊(cè)"
? ? ? ? ? ? android:textColor="@color/white"
? ? ? ? ? ? android:textSize="20sp"/>
? ? ? ? <LinearLayout
? ? ? ? ? ? android:layout_width="match_parent"
? ? ? ? ? ? android:layout_height="130dp"
? ? ? ? ? ? android:orientation="horizontal">
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? style="@style/tvone"
? ? ? ? ? ? ? ? android:drawableTop="@drawable/qq_icon"
? ? ? ? ? ? ? ? android:text="qq register"/>
? ? ? ? ? ? <View style="@style/vLine"/>
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? style="@style/tvone"
? ? ? ? ? ? ? ? android:drawableTop="@drawable/weixin_icon"
? ? ? ? ? ? ? ? android:text="wechat register"/>


? ? ? ? </LinearLayout>
? ? ? ? <View style="@style/hLine"/>
? ? ? ? <LinearLayout
? ? ? ? ? ? android:layout_width="match_parent"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:gravity="center"
? ? ? ? ? ? android:orientation="horizontal"
? ? ? ? ? ? android:padding="15dp">
? ? ? ? ? ? <ImageView
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="match_parent"
? ? ? ? ? ? ? ? android:src="@drawable/email_icon"/>
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="match_parent"
? ? ? ? ? ? ? ? android:layout_marginLeft="15dp"
? ? ? ? ? ? ? ? android:text="use email register"
? ? ? ? ? ? ? ? android:textColor="@android:color/white"
? ? ? ? ? ? ? ? android:textSize="15sp"/>
? ? ? ? </LinearLayout>
? ? ? ? <View style="@style/hLine" />
? ? ? ? <LinearLayout
? ? ? ? ? ? android:layout_width="match_parent"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:orientation="horizontal"
? ? ? ? ? ? android:padding="15dp">
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? style="@style/tvtwo"
? ? ? ? ? ? ? ? android:text="name"/>
? ? ? ? ? ? <EditText
? ? ? ? ? ? ? ? android:id="@+id/et_name"
? ? ? ? ? ? ? ? style="@style/etOne"/>
? ? ? ? </LinearLayout>
? ? ? ? <View style="@style/hLine"/>
? ? ? ? <LinearLayout
? ? ? ? ? ? android:layout_width="match_parent"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:orientation="horizontal"
? ? ? ? ? ? android:padding="15dp">
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? style="@style/tvtwo"
? ? ? ? ? ? ? ? android:text="email"/>
? ? ? ? ? ? <EditText
? ? ? ? ? ? ? ? android:id="@+id/et_mail"
? ? ? ? ? ? ? ? style="@style/etOne"/>
? ? ? ? </LinearLayout>
? ? ? ? <View style="@style/hLine"/>
? ? ? ? <LinearLayout
? ? ? ? ? ? android:layout_width="match_parent"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:orientation="horizontal"
? ? ? ? ? ? android:padding="15dp">
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? style="@style/tvtwo"
? ? ? ? ? ? ? ? android:text="password"/>
? ? ? ? ? ? <EditText
? ? ? ? ? ? ? ? android:id="@+id/et_pwd"
? ? ? ? ? ? ? ? style="@style/etOne"
? ? ? ? ? ? ? ? android:inputType="textPassword"/>
? ? ? ? </LinearLayout>

? ? ? ? <View ?style="@style/hLine"/>

? ? ? ? <LinearLayout
? ? ? ? ? ? android:layout_width="match_parent"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:orientation="horizontal"
? ? ? ? ? ? android:padding="15dp">
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? style="@style/tvtwo"
? ? ? ? ? ? ? ? android:text="glender"/>
? ? ? ? ? ? ? ? <RadioGroup
? ? ? ? ? ? ? ? ? ? android:id="@+id/rg_sex"
? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"
? ? ? ? ? ? ? ? ? ? android:layout_height="match_parent"
? ? ? ? ? ? ? ? ? ? android:layout_marginLeft="50dp"
? ? ? ? ? ? ? ? ? ? android:orientation="horizontal">
? ? ? ? ? ? ? ? ? ? <RadioButton
? ? ? ? ? ? ? ? ? ? ? ? android:id="@+id/rb_boy"
? ? ? ? ? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? ? ? ? ? android:text="man"
? ? ? ? ? ? ? ? ? ? ? ? android:textColor="@android:color/white"
? ? ? ? ? ? ? ? ? ? ? ? android:textSize="15sp"/>
? ? ? ? ? ? ? ? <RadioButton
? ? ? ? ? ? ? ? ? ? android:id="@+id/rb_girl"
? ? ? ? ? ? ? ? ? ? style="@style/tvtwo"
? ? ? ? ? ? ? ? ? ? android:text="woman"/>
? ? ? ? ? ? ? ? </RadioGroup>
? ? ? ? </LinearLayout>
? ? ? ? <View style="@style/hLine"/>
? ? ? ? <LinearLayout
? ? ? ? ? ? android:layout_width="match_parent"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:orientation="horizontal"
? ? ? ? ? ? android:padding="15dp">
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:text="chose your hobby"
? ? ? ? ? ? ? ? android:textColor="@android:color/white"
? ? ? ? ? ? ? ? android:textSize="15sp"/>
? ? ? ? ? ? <CheckBox
? ? ? ? ? ? ? ? android:id="@+id/cb_sing"
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:text="sing"
? ? ? ? ? ? ? ? android:textColor="@android:color/white"
? ? ? ? ? ? ? ? android:textSize="15sp"/>
? ? ? ? ? ? <CheckBox
? ? ? ? ? ? ? ? android:id="@+id/cb_dance"
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:text="dancing"
? ? ? ? ? ? ? ? android:textColor="@android:color/white"
? ? ? ? ? ? ? ? android:textSize="15sp"/>
? ? ? ? ? ? <CheckBox
? ? ? ? ? ? ? ? android:id="@+id/cb_read"
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:text="read"
? ? ? ? ? ? ? ? android:textColor="@android:color/white"
? ? ? ? ? ? ? ? android:textSize="15sp"/>
? ? ? ? </LinearLayout>
? ? ? ? <View style="@style/hLine"/>
? ? <View
? ? ? ? android:id="@+id/v_line"
? ? ? ? android:layout_width="match_parent"
? ? ? ? android:layout_height="1dp"
? ? ? ? android:layout_above="@+id/btn_submit"
? ? ? ? android:background="@android:color/darker_gray"/>
? ? <Button
? ? ? ? android:id="@+id/btn_submit"
? ? ? ? android:layout_width="match_parent"
? ? ? ? android:layout_height="50dp"
? ? ? ? android:layout_alignParentBottom="true"
? ? ? ? android:gravity="center"
? ? ? ? android:text="uodate"
? ? ? ? android:textColor="@android:color/white"
? ? ? ? android:background="@null"
? ? ? ? android:textSize="18sp"/>
? ? </LinearLayout>
</RelativeLayout>

在drawable下面創(chuàng)建存放圖片的文件

如何創(chuàng)建,首先復(fù)制圖片.右擊drawable,ctrl +v.

選擇第一個(gè)路徑就行.兩個(gè)路徑區(qū)別不加以贅述

下面命名就ok.

java代碼

package com.example.a19260234zjh;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements
? ? ? ? View.OnClickListener, CompoundButton.OnCheckedChangeListener {
? ? private EditText et_name,et_email,et_pwd;
? ? private Button btn_submit;
? ? private String name,email,pwd,sex,hobbys;
? ? private RadioGroup rg_sex;
? ? private CheckBox cb_sing,cb_dance,cb_read;

? ? @Override
? ? protected void onCreate(Bundle savedInstanceState) {
? ? ? ? super.onCreate(savedInstanceState);
? ? ? ? setContentView(R.layout.activity_main);
? ? ? ? init();
? ? }
? ? private void init(){
? ? ? ? et_name=findViewById(R.id.et_name);
? ? ? ? et_email=findViewById(R.id.et_mail);
? ? ? ? et_pwd=findViewById(R.id.et_pwd);
? ? ? ? rg_sex=findViewById(R.id.rg_sex);
? ? ? ? cb_sing=findViewById(R.id.cb_sing);
? ? ? ? cb_read=findViewById(R.id.cb_read);
? ? ? ? cb_dance=findViewById(R.id.cb_dance);
? ? ? ? btn_submit=findViewById(R.id.btn_submit);
? ? ? ? btn_submit.setOnClickListener(this);
? ? ? ? cb_sing.setOnCheckedChangeListener(this);
? ? ? ? cb_dance.setOnCheckedChangeListener(this);
? ? ? ? cb_read.setOnCheckedChangeListener(this);
? ? ? ? hobbys=new String();
? ? ? ? rg_sex.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
? ? ? ? ? ? @Override
? ? ? ? ? ? public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
? ? ? ? ? ? ? ? switch (checkedId){
? ? ? ? ? ? ? ? ? ? case R.id.rb_boy:
? ? ? ? ? ? ? ? ? ? ? ? sex="man";
? ? ? ? ? ? ? ? ? ? case R.id.rb_girl:
? ? ? ? ? ? ? ? ? ? ? ? sex="woman";
? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? }

? ? ? ? ? ? }
? ? ? ? });


? ? }
? ? private void getData(){
? ? ? ? name=et_name.getText().toString().trim();
? ? ? ? email=et_email.getText().toString().trim();
? ? ? ? pwd=et_pwd.getText().toString().trim();
? ? }
? ? @Override
? ? public void onClick(View v){
? ? ? ? switch (v.getId()){
? ? ? ? ? ? case R.id.btn_submit:
? ? ? ? ? ? ? ? getData();
? ? ? ? ? ? ? ? if(TextUtils.isEmpty(name)){
? ? ? ? ? ? ? ? ? ? Toast.makeText(MainActivity.this,"input name",
? ? ? ? ? ? ? ? ? ? ? ? ? ? Toast.LENGTH_SHORT).show();
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else if(TextUtils.isEmpty(email)){
? ? ? ? ? ? ? ? ? ? Toast.makeText(MainActivity.this,"input email",
? ? ? ? ? ? ? ? ? ? ? ? ? ? Toast.LENGTH_SHORT).show();
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else if(TextUtils.isEmpty(pwd)){
? ? ? ? ? ? ? ? ? ? Toast.makeText(MainActivity.this,"input password",
? ? ? ? ? ? ? ? ? ? ? ? ? ? Toast.LENGTH_SHORT).show();
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ?else if(TextUtils.isEmpty(sex)){
? ? ? ? ? ? ? ? ? ? Toast.makeText(MainActivity.this,"input glendar",
? ? ? ? ? ? ? ? ? ? ? ? ? ? Toast.LENGTH_SHORT).show();
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ?else if(TextUtils.isEmpty(hobbys)){
? ? ? ? ? ? ? ? ? ? Toast.makeText(MainActivity.this,"input hobbys",
? ? ? ? ? ? ? ? ? ? ? ? ? ? Toast.LENGTH_SHORT).show();
? ? ? ? ? ? ? ? } else{
? ? ? ? ? ? ? ? ? ? ?Toast.makeText(MainActivity.this,"success",
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Toast.LENGTH_SHORT).show();
? ? ? ? ? ? ? ? ? ? Log.i("MainActivity","information"+"name:"+name+",email:"+email+
? ? ? ? ? ? ? ? ? ? ? ? ? ? ",sex"+sex+",hobby"+hobbys);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ?break;
? ? ? ? }
? ? }
? ? @Override
? ? public void onCheckedChanged(CompoundButton buttonViwe,boolean isChecked){
? ? ? ? String motion=buttonViwe.getText().toString();
? ? ? ? if(isChecked){
? ? ? ? ? ? if(!hobbys.contains(motion)){
? ? ? ? ? ? ? ? hobbys=hobbys+motion;
? ? ? ? ? ? }
? ? ? ? }else {
? ? ? ? ? ? if(hobbys.contains(motion)){
? ? ? ? ? ? ? ? hobbys=hobbys.replace(motion,"");
? ? ? ? ? ? }
? ? ? ? }
? ? }
}

以上就是實(shí)現(xiàn)注冊(cè)頁面所需要的代碼.

效果如下:

每個(gè)人的圖片不一樣,效果也不一樣.建議圖片盡量小一些。

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論