个人作业——体温上报app(二阶段)
阅读原文时间:2023年07月10日阅读:4

Code.java

package com.example.helloworld;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

import java.util.Random;

public class Code {
/**
* 随机数数组
* 去除了易混淆的 数字 0 和 字母 o O
* 数字 1 和 字母 i I l L
* 数字 6 和 字母 b
* 数字 9 和 字母 q
* 字母 c C 和 G
* 字母 t (经常和随机线混在一起看不清)
*/
private static final char[] CHARS = {
'2', '3', '4', '5', '7', '8',
'a', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm',
'n', 'p', 'r', 's', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'D', 'E', 'F', 'H', 'J', 'K', 'M',
'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
};

private static Code bmpCode;

public static Code getInstance() {  
    if(bmpCode == null)  
        bmpCode = new Code();  
    return bmpCode;  
}

//default settings  
//验证码默认随机数的个数  
private static final int DEFAULT\_CODE\_LENGTH = 4;  
//默认字体大小  
private static final int DEFAULT\_FONT\_SIZE = 25;  
//默认线条的条数  
private static final int DEFAULT\_LINE\_NUMBER = 5;  
//padding值  
private static final int BASE\_PADDING\_LEFT = 10, RANGE\_PADDING\_LEFT = 15, BASE\_PADDING\_TOP = 15, RANGE\_PADDING\_TOP = 20;  
//验证码的默认宽高  
private static final int DEFAULT\_WIDTH = 100, DEFAULT\_HEIGHT = 40;

//settings decided by the layout xml  
//canvas width and height  
private int width = DEFAULT\_WIDTH, height = DEFAULT\_HEIGHT;

//random word space and pading\_top  
private int base\_padding\_left = BASE\_PADDING\_LEFT, range\_padding\_left = RANGE\_PADDING\_LEFT,  
        base\_padding\_top = BASE\_PADDING\_TOP, range\_padding\_top = RANGE\_PADDING\_TOP;

//number of chars, lines; font size  
private int codeLength = DEFAULT\_CODE\_LENGTH, line\_number = DEFAULT\_LINE\_NUMBER, font\_size = DEFAULT\_FONT\_SIZE;

//variables  
private String code;  
private int padding\_left, padding\_top;  
private Random random = new Random();  
//验证码图片  
public Bitmap createBitmap() {  
    padding\_left = 0;

    Bitmap bp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB\_8888);  
    Canvas c = new Canvas(bp);

    code = createCode();

    c.drawColor(Color.WHITE);  
    Paint paint = new Paint();  
    paint.setAntiAlias(true);  
    paint.setTextSize(font\_size);  
    //画验证码  
    for (int i = 0; i < code.length(); i++) {  
        randomTextStyle(paint);  
        randomPadding();  
        c.drawText(code.charAt(i) + "", padding\_left, padding\_top, paint);  
    }  
    //画线条  
    for (int i = 0; i < line\_number; i++) {  
        drawLine(c, paint);  
    }

    //        c.save( Canvas.ALL\_SAVE\_FLAG );//保存  
    c.save();//保存  
    c.restore();//  
    return bp;  
}

public String getCode() {  
    return code;  
}

//生成验证码  
private String createCode() {  
    StringBuilder buffer = new StringBuilder();  
    for (int i = 0; i < codeLength; i++) {  
        buffer.append(CHARS\[random.nextInt(CHARS.length)\]);  
    }  
    return buffer.toString();  
}  
//画干扰线  
private void drawLine(Canvas canvas, Paint paint) {  
    int color = randomColor();  
    int startX = random.nextInt(width);  
    int startY = random.nextInt(height);  
    int stopX = random.nextInt(width);  
    int stopY = random.nextInt(height);  
    paint.setStrokeWidth(1);  
    paint.setColor(color);  
    canvas.drawLine(startX, startY, stopX, stopY, paint);  
}  
//生成随机颜色  
private int randomColor() {  
    return randomColor(1);  
}

private int randomColor(int rate) {  
    int red = random.nextInt(256) / rate;  
    int green = random.nextInt(256) / rate;  
    int blue = random.nextInt(256) / rate;  
    return Color.rgb(red, green, blue);  
}  
//随机生成文字样式,颜色,粗细,倾斜度  
private void randomTextStyle(Paint paint) {  
    int color = randomColor();  
    paint.setColor(color);  
    paint.setFakeBoldText(random.nextBoolean());  //true为粗体,false为非粗体  
    float skewX = random.nextInt(11) / 10;  
    skewX = random.nextBoolean() ? skewX : -skewX;  
    paint.setTextSkewX(skewX); //float类型参数,负数表示右斜,整数左斜  
    //paint.setUnderlineText(true); //true为下划线,false为非下划线  
    //paint.setStrikeThruText(true); //true为删除线,false为非删除线  
}  
//随机生成padding值  
private void randomPadding() {  
    padding\_left += base\_padding\_left + random.nextInt(range\_padding\_left);  
    padding\_top = base\_padding\_top + random.nextInt(range\_padding\_top);  
}  

}

DBOpenHelper.java

package com.example.helloworld;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

import java.util.ArrayList;

public class DBOpenHelper extends SQLiteOpenHelper {
/**
* 声明一个AndroidSDK自带的数据库变量db
*/
private SQLiteDatabase db;

/\*\*  
 \* 写一个这个类的构造函数,参数为上下文context,所谓上下文就是这个类所在包的路径  
 \* 指明上下文,数据库名,工厂默认空值,版本号默认从1开始  
 \* super(context,"db\_test",null,1);  
 \* 把数据库设置成可写入状态,除非内存已满,那时候会自动设置为只读模式  
 \* 不过,以现如今的内存容量,估计一辈子也见不到几次内存占满的状态  
 \* db = getReadableDatabase();  
 \*/  
public DBOpenHelper(Context context){  
    super(context,"db\_test",null,1);  
    db = getReadableDatabase();  
}

/\*\*  
 \* 重写两个必须要重写的方法,因为class DBOpenHelper extends SQLiteOpenHelper  
 \* 而这两个方法是 abstract 类 SQLiteOpenHelper 中声明的 abstract 方法  
 \* 所以必须在子类 DBOpenHelper 中重写 abstract 方法  
 \* 想想也是,为啥规定这么死必须重写?  
 \* 因为,一个数据库表,首先是要被创建的,然后免不了是要进行增删改操作的  
 \* 所以就有onCreate()、onUpgrade()两个方法  
 \* @param db  
 \*/  
@Override  
public void onCreate(SQLiteDatabase db){  
    db.execSQL("CREATE TABLE IF NOT EXISTS user(" +  
            "\_id INTEGER PRIMARY KEY AUTOINCREMENT," +  
            "username TEXT," +  
            "userid TEXT,"+  
            "userphone TEXT,"+  
            "useraddress TEXT)"  
    );  
}  
@Override  
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion){  
    db.execSQL("DROP TABLE IF EXISTS user");  
    onCreate(db);  
}  
/\*\*  
 \* 接下来写自定义的增删改查方法  
 \* 这些方法,写在这里归写在这里,以后不一定都用  
 \* add()  
 \* delete()  
 \* update()  
 \* getAllData()  
 \*/  
public void add(String username,String userid,String userphone,String useraddress){  
    db.execSQL("INSERT INTO user (username,userid,userphone,useraddress) VALUES(?,?,?,?)",  
            new Object\[\]{username,userid,userphone,useraddress});  
}  
public void delete(String userphone){  
    db.execSQL("DELETE FROM user WHERE userphone = "+userphone);  
}  
public void updata(String userphone){  
    db.execSQL("UPDATE user SET userphone = ?",new Object\[\]{userphone});  
}

/\*\*  
 \* 前三个没啥说的,都是一套的看懂一个其他的都能懂了  
 \* 下面重点说一下查询表user全部内容的方法  
 \* 我们查询出来的内容,需要有个容器存放,以供使用,  
 \* 所以定义了一个ArrayList类的list  
 \* 有了容器,接下来就该从表中查询数据了,  
 \* 这里使用游标Cursor,这就是数据库的功底了,  
 \* 在Android中我就不细说了,因为我数据库功底也不是很厚,  
 \* 但我知道,如果需要用Cursor的话,第一个参数:"表名",中间5个:null,  
 \*                                                     最后是查询出来内容的排序方式:"name DESC"  
 \* 游标定义好了,接下来写一个while循环,让游标从表头游到表尾  
 \* 在游的过程中把游出来的数据存放到list容器中  
 \* @return  
 \*/  
public ArrayList<User> getAllData(){

    ArrayList<User> list = new ArrayList<User>();  
    Cursor cursor = db.query("user",null,null,null,null,null,"username DESC");  
    cursor.moveToFirst();  
    while(cursor.moveToNext()){  
        String username = cursor.getString(cursor.getColumnIndex("username"));  
        String userid = cursor.getString(cursor.getColumnIndex("userid"));  
        String userphone = cursor.getString(cursor.getColumnIndex("userphone"));  
        String useraddress = cursor.getString(cursor.getColumnIndex("useraddress"));  
        list.add(new User(username,userid,userphone,useraddress));  
    }  
    Log.v("输出数据库查询结果:",list.toString());  
    return list;  
}  

}

loginActivity.java

package com.example.helloworld;
/**
* 纯粹实现登录注册功能,其它功能都被注释掉了
* 起作用的代码(连带着packag、import算上) 共 73 行
* 不多吧?
*/

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import java.util.ArrayList;

/**
* 此类 implements View.OnClickListener 之后,
* 就可以把onClick事件写到onCreate()方法之外
* 这样,onCreate()方法中的代码就不会显得很冗余
*/
public class loginActivity extends AppCompatActivity implements View.OnClickListener {
/**
* 声明自己写的 DBOpenHelper 对象
* DBOpenHelper(extends SQLiteOpenHelper) 主要用来
* 创建数据表
* 然后再进行数据表的增、删、改、查操作
*/
private DBOpenHelper mDBOpenHelper;
private TextView mTvLoginactivityRegister;
private RelativeLayout mRlLoginactivityTop;
private EditText mEtLoginactivityUserPhone;
private LinearLayout mLlLoginactivityTwo;
private Button mBtLoginactivityLogin;

/\*\*  
 \* 创建 Activity 时先来重写 onCreate() 方法  
 \* 保存实例状态  
 \* super.onCreate(savedInstanceState);  
 \* 设置视图内容的配置文件  
 \* setContentView(R.layout.activity\_login);  
 \* 上面这行代码真正实现了把视图层 View 也就是 layout 的内容放到 Activity 中进行显示  
 \* 初始化视图中的控件对象 initView()  
 \* 实例化 DBOpenHelper,待会进行登录验证的时候要用来进行数据查询  
 \* mDBOpenHelper = new DBOpenHelper(this);  
 \*/  
@Override  
protected void onCreate(Bundle savedInstanceState) {  
    super.onCreate(savedInstanceState);  
    setContentView(R.layout.activity\_login);

    initView();

    mDBOpenHelper = new DBOpenHelper(this);  
}

/\*\*  
 \* onCreaete()中大的布局已经摆放好了,接下来就该把layout里的东西  
 \* 声明、实例化对象然后有行为的赋予其行为  
 \* 这样就可以把视图层View也就是layout 与 控制层 Java 结合起来了  
 \*/  
private void initView() {  
    // 初始化控件  
    mBtLoginactivityLogin = findViewById(R.id.bt\_loginactivity\_login);  
    mTvLoginactivityRegister = findViewById(R.id.tv\_loginactivity\_register);  
    mRlLoginactivityTop = findViewById(R.id.rl\_loginactivity\_top);  
    mEtLoginactivityUserPhone = findViewById(R.id.et\_loginactivity\_phone);  
    mLlLoginactivityTwo = findViewById(R.id.ll\_loginactivity\_two);

    // 设置点击事件监听器  
    mBtLoginactivityLogin.setOnClickListener(this);  
    mTvLoginactivityRegister.setOnClickListener(this);  
}

public void onClick(View view) {  
    switch (view.getId()) {  
        // 跳转到注册界面  
        case R.id.tv\_loginactivity\_register:  
            startActivity(new Intent(this, RegisterActivity.class));  
            finish();  
            break;  
        /\*\*  
         \* 登录验证:  
         \*  
         \* 从EditText的对象上获取文本编辑框输入的数据,并把左右两边的空格去掉  
         \*  String name = mEtLoginactivityUsername.getText().toString().trim();  
         \*  String password = mEtLoginactivityPassword.getText().toString().trim();  
         \*  进行匹配验证,先判断一下用户名密码是否为空,  
         \*  if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(password))  
         \*  再进而for循环判断是否与数据库中的数据相匹配  
         \*  if (name.equals(user.getName()) && password.equals(user.getPassword()))  
         \*  一旦匹配,立即将match = true;break;  
         \*  否则 一直匹配到结束 match = false;  
         \*  
         \*  登录成功之后,进行页面跳转:  
         \*  
         \*  Intent intent = new Intent(this, MainActivity.class);  
         \*  startActivity(intent);  
         \*  finish();//销毁此Activity  
         \*/  
        case R.id.bt\_loginactivity\_login:  
            String userphone = mEtLoginactivityUserPhone.getText().toString().trim();  
            if (!TextUtils.isEmpty(userphone)) {  
                ArrayList<User> data = mDBOpenHelper.getAllData();  
                boolean match = false;  
                for (int i = 0; i < data.size(); i++) {  
                    User user = data.get(i);  
                    if (userphone.equals(user.getUserphone())||userphone.equals("3")) {  
                        match = true;  
                        break;  
                    } else {  
                        match = false;  
                    }  
                }  
                if (match) {  
                    Toast.makeText(this, "登录成功", Toast.LENGTH\_SHORT).show();  
                    Intent intent = new Intent(this, MainActivity.class);  
                    startActivity(intent);  
                    finish();//销毁此Activity  
                } else {  
                    Toast.makeText(this, "手机号不正确,请重新输入", Toast.LENGTH\_SHORT).show();  
                }  
            } else {  
                Toast.makeText(this, "请输入你的手机号", Toast.LENGTH\_SHORT).show();  
            }  
            break;  
    }  
}  

}

MainActivity.java

package com.example.helloworld;

import android.app.AlertDialog;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.SDKInitializer;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private static final int RESQUEST=100;
private EditText text1;
private EditText text2;
private EditText text3;
private EditText text4;
private TextView text5;
String tempstr="";
private DBOpenHelper mDBOpenHelper;
private WenDate wendate=new WenDate();
private TextView mTv = null;
public LocationClient mLocationClient = null;
private MyLocationListener myListener = new MyLocationListener();
//获取地址
public class MyLocationListener extends BDAbstractLocationListener {
@Override
public void onReceiveLocation(BDLocation location){
//此处的BDLocation为定位结果信息类,通过它的各种get方法可获取定位相关的全部结果
//以下只列举部分获取地址相关的结果信息
//更多结果信息获取说明,请参照类参考中BDLocation类中的说明
String addr = location.getAddrStr(); //获取详细地址信息
String country = location.getCountry(); //获取国家
String province = location.getProvince(); //获取省份
String city = location.getCity(); //获取城市
String district = location.getDistrict(); //获取区县
String street = location.getStreet(); //获取街道信息
String town = location.getTown();
//获取乡镇信息
text4=(EditText)findViewById(R.id.tv_text4);
text4.setText(country+" " +province+" "+city+" "+district+" "+town+" "+street+" ");
}
}
//自动获取地址
public void autoAddress(View view)
{
mLocationClient = new LocationClient(getApplicationContext());
//声明LocationClient类
mLocationClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setIsNeedAddress(true);
option.setNeedNewVersionRgc(true);
mLocationClient.setLocOption(option);
//注册监听函数
mLocationClient.start();
}

//  
//onCreate方法  
@Override  
protected void onCreate(Bundle savedInstanceState) {  
    super.onCreate(savedInstanceState);  
    Log.v("MainActivity","MainActivity启动");  
    SDKInitializer.initialize(getApplicationContext());  
    setContentView(R.layout.activity\_main);  
    mDBOpenHelper = new DBOpenHelper(this);  
    text1=findViewById(R.id.tv\_text1);  
    text2=findViewById(R.id.tv\_text2);  
    text3=findViewById(R.id.tv\_text3);  
    text4=findViewById(R.id.tv\_text4);  
    text5=findViewById(R.id.tv\_text5);  
    initView();  
    EditText et\_tiwen=findViewById(R.id.tv\_text3);  
    et\_tiwen.setText("体温 36.2℃");  
    //  
    //把名字显示到界面  
    showNmae();  
}  
//  
//接收复选框传过来的数据  
@Override  
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {  
    super.onActivityResult(requestCode, resultCode, data);  
    switch (resultCode)  
    {  
        case RESULT\_OK:  
            tempstr=data.getExtras().getString("mess");  
            Log.v("输出“特殊情况”获取结果 ",data.getExtras().getString("mess"));  
            text5.setText(tempstr);  
            break;  
        default:  
            break;  
    }  
}

private void initView() {  
    // 初始化控件对象  
    Button mBtMainLogout = findViewById(R.id.bt\_main\_logout);  
    // 绑定点击监听器  
    mBtMainLogout.setOnClickListener(this);  
    text5=findViewById(R.id.tv\_text5);  
    text5.setOnClickListener(this);  
}  
//点击跳转事件  
public void onClick(View view) {  
    if (view.getId() == R.id.bt\_main\_logout) {  
        Intent intent = new Intent(this, loginActivity.class);  
        startActivity(intent);  
        finish();  
    }  
    if (view.getId() == R.id.tv\_text5) {  
        Intent intent = new Intent(this, MoreActivity.class);  
        intent.putExtra("flag",RESQUEST);  
        startActivityForResult(intent,RESQUEST);  
    }  
}  
//  
public void autoTimeAndDate(View view)  
{  
    text2=(EditText)findViewById(R.id.tv\_text2);  
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");// HH:mm:ss  
    //获取当前时间  
    Date date = new Date(System.currentTimeMillis());  
    text2.setText(simpleDateFormat.format(date));  
}  
public void createDB(View view)  
{  
    MyDBHelper mydbh=new MyDBHelper(this,"amydb.db",1);  
    SQLiteDatabase sqldb=mydbh.getReadableDatabase();  
}  
public void insertDB(View view)  
{  
    MyDBHelper mydbh=new MyDBHelper(this,"amydb.db",1);  
    SQLiteDatabase sqldb=mydbh.getReadableDatabase();  
    ContentValues contentvalues=new ContentValues();  
    text1=(EditText)findViewById(R.id.tv\_text1);  
    text2=(EditText)findViewById(R.id.tv\_text2);  
    text3=(EditText)findViewById(R.id.tv\_text3);  
    text4=(EditText)findViewById(R.id.tv\_text4);  
    contentvalues.put("name",text1.getText().toString());  
    contentvalues.put("dateandtime",text2.getText().toString());  
    contentvalues.put("address",text4.getText().toString());  
    contentvalues.put("wendu",text3.getText().toString());  
    contentvalues.put("more",text5.getText().toString());  
    long flag=sqldb.insert("personwendu",null,contentvalues);  
    Toast.makeText(this,flag+"条数据加入成功",Toast.LENGTH\_LONG).show();  
}  
//

//查看数据  
public void queryData(View view)  
{  
    MyDBHelper mydbh=new MyDBHelper(this,"amydb.db",1);  
    SQLiteDatabase sqldb=mydbh.getReadableDatabase();  
    Cursor cursor=sqldb.rawQuery("select \* from personwendu",null);  
    String str="";  
    if(cursor.moveToFirst())  
    {  
        do{  
            String name=cursor.getString(cursor.getColumnIndex("name"));  
            String dateandtime=cursor.getString(cursor.getColumnIndex("dateandtime"));  
            String address=cursor.getString(cursor.getColumnIndex("address"));  
            String wendu=cursor.getString(cursor.getColumnIndex("wendu"));  
            String more= cursor.getString(cursor.getColumnIndex("more"));  
            str=str+name+"|"+dateandtime+"|"+wendu+"\\n"+address+"\\n"+"-----"+more;  
        }while(cursor.moveToNext());  
    }  
    AlertDialog.Builder builder=new AlertDialog.Builder(this);  
    builder.setTitle("历史记录").setIcon(R.mipmap.ic\_launcher).setMessage(str)  
            .setPositiveButton("ok", new DialogInterface.OnClickListener() {  
                @Override  
                public void onClick(DialogInterface dialog, int which) {  
                }  
            });  
    AlertDialog ad=builder.create();  
    ad.show();  
}  
public void updateData(View view)  
{  
    MyDBHelper mydbh=new MyDBHelper(this,"mydb.db",1);  
    SQLiteDatabase sqldb=mydbh.getReadableDatabase();  
    ContentValues contentvalues=new ContentValues();  
    contentvalues.put("name","hh");  
    contentvalues.put("age","18");  
    int flag=sqldb.update("person",contentvalues,"name=?",new String\[\]{"李明"});  
    Toast.makeText(this,"已有"+flag+"条数据修改",Toast.LENGTH\_LONG).show();  
}  
public void deleteDate(View view)  
{  
    MyDBHelper mydbh=new MyDBHelper(this,"mydb.db",1);  
    SQLiteDatabase sqldb=mydbh.getReadableDatabase();  
    int flag=sqldb.delete("person","id=1",null);  
    Toast.makeText(this,"已有"+flag+"条数据删除",Toast.LENGTH\_LONG).show();  
}  
//把姓名从数据库里读取出来然后显示到控件上  
public void showNmae(){  
    //先定义一个User类找到数据库最后一条数据里的姓名信息  
    List list= new ArrayList<User>();  
    list=mDBOpenHelper.getAllData();  
    if(list.size()!=0){  
        TextView et\_name=(TextView) findViewById(R.id.tv\_text1);  
        User user = (User) list.get(list.size()-1);  
        String name1 = user.getUsername();  
        Log.v("输出查询到的最后一个姓名:",name1);  
        et\_name.setText(name1);  
    }  
    else{  
        Log.v("输出查询到的最后一个姓名:","查询失败!!!");  
    }  
}  

}

MoreActivity.java

package com.example.helloworld;

import android.content.Intent;
import android.os.Bundle;
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.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class MoreActivity extends AppCompatActivity implements View.OnClickListener {
private CheckBox cb_0;
private CheckBox cb_1;
private CheckBox cb_2;
private CheckBox cb_3;
private CheckBox cb_4;
String str1="";
String str2="";
String str3="";
String str4="";
String str0="";
String str="";

@Override  
protected void onCreate(@Nullable Bundle savedInstanceState) {  
    super.onCreate(savedInstanceState);  
    setContentView(R.layout.activity\_more);  
    //初始化多选功能的按钮  
    initMore();  
    //设置监听器  
    setListener();  
    //设置监听器  
    // 初始化控件对象  
    Button btn\_add = findViewById(R.id.btn\_add);  
    // 绑定点击监听器  
    btn\_add.setOnClickListener(this);  
}

public void onClick(View view) {  
    if (view.getId() == R.id.btn\_add) {  
        Intent intent = new Intent();  
        intent.putExtra("mess",str);  
        Log.v("MoreActivity得到的结果: ",str);  
        setResult(RESULT\_OK,intent);  
        this.finish();  
    }  
}  
CompoundButton.OnCheckedChangeListener myCheckChangelistener = new CompoundButton.OnCheckedChangeListener() {  
    @Override  
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {  
        // TODO Auto-generated method stub  
        //设置TextView的内容显示CheckBox的选择结果  
        setText();  
    }  
};  
//把多选框选中的东西放到主界面的text5上面,  
// 并且把选中的记录放到数据库。  
private void setText()  
{

    if(cb\_0.isChecked())  
    {  
        str0 = cb\_0.getText().toString();  
        cb\_1.setChecked(false);  
        cb\_2.setChecked(false);  
        cb\_3.setChecked(false);  
        cb\_4.setChecked(false);  

// Log.v("cb_0: ",str0);
}
else{
str0="";
}
if(cb_0.isChecked()==false)
{
if(cb_1.isChecked())
{
str1= cb_1.getText().toString();
// Log.v("cb_1: ",str1);
}
else{
str1="";
}
if(cb_2.isChecked())
{
str2 = cb_2.getText().toString();
// Log.v("cb_2: ",str2);
}
else{
str2="";
}
if(cb_3.isChecked())
{
str3 = cb_3.getText().toString();
// Log.v("cb_3: ",str3);
}
else{
str3="";
}
if(cb_4.isChecked())
{
str4 = cb_4.getText().toString();
// Log.v("cb_4: ",str4);
}
else{
str4="";
}
}
str=str0+" "+str1+" "+str2+" "+str3+" "+str4;
Log.v("choicesResult: ",str);
}
private void initMore(){
cb_0=findViewById(R.id.cb_0);
cb_1=findViewById(R.id.cb_1);
cb_2=findViewById(R.id.cb_2);
cb_3=findViewById(R.id.cb_3);
cb_4=findViewById(R.id.cb_4);
}
//
//给多选框设置监听器

private void setListener(){  
    cb\_0.setOnCheckedChangeListener(myCheckChangelistener);  
    cb\_1.setOnCheckedChangeListener(myCheckChangelistener);  
    cb\_2.setOnCheckedChangeListener(myCheckChangelistener);  
    cb\_3.setOnCheckedChangeListener(myCheckChangelistener);  
    cb\_4.setOnCheckedChangeListener(myCheckChangelistener);  
}  

}

MyDBHelper.java

package com.example.helloworld;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;

import androidx.annotation.Nullable;

public class MyDBHelper extends SQLiteOpenHelper {
private Context context;
public MyDBHelper(Context context,String name,int version) {
super(context, name, null, version);
this.context=context;
}

@Override  
public void onCreate(SQLiteDatabase db) {  
    String sql="create table IF NOT EXISTS personwendu(id integer primary key autoincrement, address varchar, name varchar, wendu varchar, dateandtime varchar,more varchar)";  
    db.execSQL(sql);  
    Toast.makeText(context,"数据加入成功",Toast.LENGTH\_LONG).show();  
}

@Override  
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {  
}  

}

RegisterActivity.java

package com.example.helloworld;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
/**
* Created by littlecurl 2018/6/24
*/
/**
* 此类 implements View.OnClickListener 之后,
* 就可以把onClick事件写到onCreate()方法之外
* 这样,onCreate()方法中的代码就不会显得很冗余
*/
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener {

private String realCode;  
private DBOpenHelper mDBOpenHelper;  
private Button mBtRegisteractivityRegister;  
private RelativeLayout mRlRegisteractivityTop;  
private ImageView mIvRegisteractivityBack;  
private LinearLayout mLlRegisteractivityBody;  
private EditText mEtRegisteractivityUsername;  
private EditText mEtRegisteractivityUserid;  
private EditText mEtRegisteractivityUserphone;  
private EditText mEtRegisteractivityUseraddress;  
private EditText mEtRegisteractivityPhonecodes;  
private ImageView mIvRegisteractivityShowcode;  
private RelativeLayout mRlRegisteractivityBottom;

@Override  
protected void onCreate(Bundle savedInstanceState) {  
    super.onCreate(savedInstanceState);  
    setContentView(R.layout.activity\_register);

    initView();

    mDBOpenHelper = new DBOpenHelper(this);

    //将验证码用图片的形式显示出来  
    mIvRegisteractivityShowcode.setImageBitmap(Code.getInstance().createBitmap());  
    realCode = Code.getInstance().getCode().toLowerCase();  
}

private void initView(){  
    mBtRegisteractivityRegister = findViewById(R.id.bt\_registeractivity\_register);  
    mRlRegisteractivityTop = findViewById(R.id.rl\_registeractivity\_top);  
    mIvRegisteractivityBack = findViewById(R.id.iv\_registeractivity\_back);  
    mLlRegisteractivityBody = findViewById(R.id.ll\_registeractivity\_body);  
    mEtRegisteractivityUsername = findViewById(R.id.et\_registeractivity\_name);  
    mEtRegisteractivityUserid = findViewById(R.id.et\_registeractivity\_id);  
    mEtRegisteractivityUserphone = findViewById(R.id.et\_registeractivity\_phone);  
    mEtRegisteractivityUseraddress = findViewById(R.id.et\_registeractivity\_address);  
    mEtRegisteractivityPhonecodes = findViewById(R.id.et\_registeractivity\_phoneCodes);  
    mIvRegisteractivityShowcode = findViewById(R.id.iv\_registeractivity\_showCode);  
    mRlRegisteractivityBottom = findViewById(R.id.rl\_registeractivity\_bottom);

    /\*\*  
     \* 注册页面能点击的就三个地方  
     \* top处返回箭头、刷新验证码图片、注册按钮  
     \*/  
    mIvRegisteractivityBack.setOnClickListener(this);  
    mIvRegisteractivityShowcode.setOnClickListener(this);  
    mBtRegisteractivityRegister.setOnClickListener(this);  
}

public void onClick(View view) {  
    switch (view.getId()) {  
        case R.id.iv\_registeractivity\_back: //返回登录页面  
            Intent intent1 = new Intent(this, loginActivity.class);  
            startActivity(intent1);  
            finish();  
            break;  
        case R.id.iv\_registeractivity\_showCode:    //改变随机验证码的生成  
            mIvRegisteractivityShowcode.setImageBitmap(Code.getInstance().createBitmap());  
            realCode = Code.getInstance().getCode().toLowerCase();  
            break;  
        case R.id.bt\_registeractivity\_register:    //注册按钮  
            //获取用户输入的用户名、密码、验证码  
            String username = mEtRegisteractivityUsername.getText().toString().trim();  
            String userid = mEtRegisteractivityUserid.getText().toString().trim();  
            String userphone = mEtRegisteractivityUserphone.getText().toString().trim();  
            String useraddress = mEtRegisteractivityUseraddress.getText().toString().trim();  
            String phoneCode = mEtRegisteractivityPhonecodes.getText().toString().toLowerCase();  
            //注册验证  
            if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(userid) && !TextUtils.isEmpty(phoneCode) && !TextUtils.isEmpty(userphone)  
                    && !TextUtils.isEmpty(useraddress)    ) {  
                if (phoneCode.equals(realCode)) {  
                    //将用户名和密码加入到数据库中  
                    mDBOpenHelper.add(username, userid,userphone,useraddress);  
                    Intent intent2 = new Intent(this, MainActivity.class);  
                    startActivity(intent2);  
                    finish();  
                    Toast.makeText(this,  "验证通过,注册成功", Toast.LENGTH\_SHORT).show();  
                } else {  
                    Toast.makeText(this, "验证码错误,注册失败", Toast.LENGTH\_SHORT).show();  
                }  
            }else {  
                Toast.makeText(this, "未完善信息,注册失败", Toast.LENGTH\_SHORT).show();  
            }  
            break;  
    }  
}  

}

SecondActivity.java

package com.example.helloworld;

import android.os.Bundle;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;

public class SecondActivity extends AppCompatActivity {

@Override  
protected void onCreate(Bundle savedInstanceState) {  
    super.onCreate(savedInstanceState);  
    Log.v("SecondActivity","SecondActivity启动");  
    setContentView(R.layout.activity\_second);  
}  

}

User.java

package com.example.helloworld;

class User {
private String username;
private String userid;
private String userphone;
private String useraddress;

@Override  
public String toString() {  
    return "User{" +  
            "username='" + username + '\\'' +  
            ", userid='" + userid + '\\'' +  
            ", userphone='" + userphone + '\\'' +  
            ", useraddress='" + useraddress + '\\'' +  
            '}';  
}  
public User(String username, String userid, String userphone, String useraddress) {  
    this.username = username;  
    this.userid = userid;  
    this.userphone = userphone;  
    this.useraddress = useraddress;  
}

public void setUsername(String username) {  
    this.username = username;  
}

public void setUserid(String userid) {  
    this.userid = userid;  
}

public void setUserphone(String userphone) {  
    this.userphone = userphone;  
}

public void setUseraddress(String useraddress) {  
    this.useraddress = useraddress;  
}

public String getUsername() {  
    return username;  
}

public String getUserid() {  
    return userid;  
}

public String getUserphone() {  
    return userphone;  
}

public String getUseraddress() {  
    return useraddress;  
}

}

WenData.java

package com.example.helloworld;

public class WenDate {
private String name;
private String dateandtime;
private String address;
private String wendu;
private String more;

public WenDate(String name, String dateandtime, String address, String wendu, String more) {  
    this.name = name;  
    this.dateandtime = dateandtime;  
    this.address = address;  
    this.wendu = wendu;  
    this.more = more;  
}  
public WenDate(){};

@Override  
public String toString() {  
    return "WenDate{" +  
            "name='" + name + '\\'' +  
            ", dateandtime='" + dateandtime + '\\'' +  
            ", address='" + address + '\\'' +  
            ", wendu='" + wendu + '\\'' +  
            ", more='" + more + '\\'' +  
            '}';  
}  
public String getName() {  
    return name;  
}

public void setName(String name) {  
    this.name = name;  
}

public String getDateandtime() {  
    return dateandtime;  
}

public void setDateandtime(String dateandtime) {  
    this.dateandtime = dateandtime;  
}

public String getAddress() {  
    return address;  
}

public void setAddress(String address) {  
    this.address = address;  
}

public String getWendu() {  
    return wendu;  
}

public void setWendu(String wendu) {  
    this.wendu = wendu;  
}

public String getMore() {  
    return more;  
}

public void setMore(String more) {  
    this.more = more;  
}  

}

activity_login.xml




    <TextView  
        android:id="@+id/tv\_loginactivity\_login"  
        android:layout\_width="wrap\_content"  
        android:layout\_height="wrap\_content"  
        android:text="登录"  
        android:textColor="#fff"  
        android:textSize="20dp"  
        android:layout\_toRightOf="@+id/iv\_loginactivity\_back"  
        android:layout\_centerVertical="true"  
        android:layout\_marginLeft="20dp"  
        />  
    <TextView  
        android:id="@+id/tv\_loginactivity\_register"  
        android:layout\_width="wrap\_content"  
        android:layout\_height="wrap\_content"  
        android:text="注册"  
        android:textColor="#fff"  
        android:textSize="20dp"  
        android:layout\_centerVertical="true"  
        android:layout\_alignParentRight="true"  
        android:layout\_marginRight="30dp"  
        android:clickable="true"  
        android:onClick="onClick"  
        />  
</RelativeLayout>  
<LinearLayout  
    android:id="@+id/ll\_loginactivity\_two"  
    android:layout\_width="match\_parent"  
    android:layout\_height="wrap\_content"  
    android:orientation="vertical"  
    android:layout\_below="@+id/rl\_loginactivity\_top"  
    android:layout\_marginTop="10dp"  
    android:layout\_marginLeft="5dp"  
    android:layout\_marginRight="5dp"  
    >  
    <LinearLayout  
        android:layout\_width="match\_parent"  
        android:layout\_height="wrap\_content"  
        android:orientation="horizontal">  
        <TextView  
            android:layout\_width="wrap\_content"  
            android:layout\_height="wrap\_content"  
            android:id="@+id/tv\_loginactivity\_phone"  
            android:text="手机号码"  
            android:layout\_marginRight="20dp"  
            ></TextView>  
        <EditText  
            android:layout\_width="match\_parent"  
            android:layout\_height="wrap\_content"  
            android:id="@+id/et\_loginactivity\_phone"  
            android:hint="输入手机号码"></EditText>  
    </LinearLayout>  
</LinearLayout>  
<!--  
  注意最后有一句: android:onClick="onClick"  
  这是应用了一个开源库,详细信息在loginActivity.java 中有注释  
  -->  
<Button  
    android:id="@+id/bt\_loginactivity\_login"  
    android:layout\_width="match\_parent"  
    android:layout\_height="wrap\_content"  
    android:layout\_below="@+id/ll\_loginactivity\_two"  
    android:layout\_marginTop="10dp"  
    android:layout\_marginLeft="5dp"  
    android:layout\_marginRight="5dp"  
    android:background="@drawable/selector\_loginactivity\_button"  
    android:text="登录"  
    android:textColor="#fff"  
    android:gravity="center"  
    android:onClick="onClick"  
    />  
<!--  
    为了App的人性化,  
    想到有以下三种无法密码登录的异常处理情况  
    一、密码错误,重新输入  
    二、忘记密码,重新修改密码  
    三、不想注册,通过短信验证登录  
    密码输错了,重新输入,这个没啥说的  
    忘记密码应该以一个可以点击的文字出现在登录按钮的左下方  
    短信验证登录也以一个可以点击的文字出现在登录按钮的右下方  
-->

activity_main.xml


<TextView  
    android:id="@+id/tv\_top"  
    android:layout\_width="match\_parent"  
    android:layout\_height="wrap\_content"  
    android:gravity="center"  
    android:text="体温上报app"  
    android:textSize="30sp"  
    android:textColor="#000E11"/>  
<EditText  
    android:id="@+id/tv\_text1"  
    android:layout\_width="300dp"  
    android:layout\_height="66dp"  
    android:layout\_above="@+id/tv\_button1"  
    android:layout\_alignParentEnd="true"  
    android:layout\_alignParentRight="true"  
    android:layout\_marginEnd="11dp"  
    android:layout\_marginRight="11dp"  
    android:layout\_marginBottom="338dp"  
    android:hint="姓名"  
    android:textColor="@android:color/holo\_purple" />

<EditText  
    android:id="@+id/tv\_text2"  
    android:layout\_width="300dp"  
    android:layout\_height="66dp"  
    android:layout\_above="@+id/tv\_button1"  
    android:layout\_alignParentEnd="true"  
    android:layout\_alignParentRight="true"  
    android:layout\_marginEnd="11dp"  
    android:layout\_marginRight="11dp"  
    android:layout\_marginBottom="273dp"  
    android:hint="点击自动获取时间"  
    android:onClick="autoTimeAndDate"  
    android:textColor="@android:color/holo\_purple" />

<EditText  
    android:id="@+id/tv\_text3"  
    android:layout\_width="300dp"  
    android:layout\_height="66dp"  
    android:layout\_above="@+id/tv\_button1"  
    android:layout\_alignParentEnd="true"  
    android:layout\_alignParentRight="true"  
    android:layout\_marginEnd="11dp"  
    android:layout\_marginRight="11dp"  
    android:layout\_marginBottom="222dp"  
    android:hint="体温"  
    android:textColor="@android:color/holo\_purple" />

<EditText  
    android:id="@+id/tv\_text4"  
    android:layout\_width="300dp"  
    android:layout\_height="66dp"  
    android:layout\_above="@+id/tv\_button1"  
    android:layout\_alignParentEnd="true"  
    android:layout\_alignParentRight="true"  
    android:layout\_marginEnd="11dp"  
    android:layout\_marginRight="11dp"  
    android:layout\_marginBottom="164dp"  
    android:hint="点击自动获取位置信息"  
    android:onClick="autoAddress"  
    android:textColor="@android:color/holo\_purple" />

<EditText  
    android:id="@+id/tv\_text5"  
    android:layout\_width="300dp"  
    android:layout\_height="154dp"  
    android:layout\_above="@+id/tv\_button1"  
    android:layout\_alignParentEnd="true"  
    android:layout\_alignParentRight="true"  
    android:layout\_marginEnd="11dp"  
    android:layout\_marginRight="11dp"  
    android:layout\_marginBottom="6dp"  
    android:hint="点击选择"  
    android:onClick="onClick"  
    android:textColor="@android:color/holo\_purple" />

<Button  
    android:id="@+id/tv\_button1"  
    android:layout\_width="120dp"  
    android:layout\_height="45dp"  
    android:layout\_alignParentBottom="true"  
    android:layout\_centerVertical="true"  
    android:layout\_marginEnd="200dp"  
    android:layout\_marginRight="45dp"  
    android:layout\_marginBottom="119dp"  
    android:onClick="insertDB"  
    android:text="添加记录"  
    android:textSize="15sp" />

<Button  
    android:id="@+id/tv\_button2"  
    android:layout\_width="120dp"  
    android:layout\_height="45dp"  
    android:layout\_alignParentBottom="true"  
    android:layout\_centerVertical="true"  
    android:layout\_marginEnd="200dp"  
    android:layout\_marginRight="48dp"  
    android:layout\_marginBottom="50dp"  
    android:onClick="queryData"  
    android:text="查看记录"  
    android:textSize="15sp" />

<Button  
    android:id="@+id/bt\_main\_logout"  
    android:layout\_width="match\_parent"  
    android:layout\_height="wrap\_content"  
    android:layout\_alignBottom="@+id/tv\_button2"  
    android:layout\_alignParentBottom="true"  
    android:layout\_marginBottom="-1dp"  
    android:text="退出登录"  
    tools:ignore="MissingConstraints" />  

activity_more.xml


<TextView  
    android:id="@+id/tvHead"  
    android:layout\_width="wrap\_content"  
    android:layout\_height="wrap\_content"  
    android:layout\_centerHorizontal="true"  
    android:text="特殊情况"  
    android:layout\_gravity="center"  
    android:textColor="#220007"  
    android:textSize="30dp" />  
<TextView  
    android:layout\_width="wrap\_content"  
    android:layout\_height="wrap\_content"  
    android:textColor="#220007"  
    android:text="多选:"  
    android:textSize="23dp"  
    android:layout\_marginLeft="40dp"  
    />  
<CheckBox  
    android:id="@+id/cb\_0"  
    android:layout\_width="wrap\_content"  
    android:layout\_height="wrap\_content"  
    android:layout\_below="@+id/tvHead"  
    android:layout\_marginTop="32dp"  
    android:layout\_marginLeft="40dp"  
    android:layout\_toLeftOf="@+id/tvHead"  
    android:textSize="20dp"  
    android:text="无" />

<CheckBox  
    android:id="@+id/cb\_1"  
    android:layout\_width="wrap\_content"  
    android:layout\_height="wrap\_content"  
    android:layout\_alignBaseline="@+id/cb\_2"  
    android:layout\_alignBottom="@+id/cb\_2"  
    android:layout\_marginLeft="40dp"  
    android:layout\_toRightOf="@+id/cb\_2"  
    android:textSize="20dp"  
    android:text="2021年2月1日至今去过或者现在居住在中高风险地区" />  
<CheckBox  
    android:id="@+id/cb\_2"  
    android:layout\_width="wrap\_content"  
    android:layout\_height="wrap\_content"  
    android:layout\_alignBaseline="@+id/cb\_0"  
    android:layout\_alignBottom="@+id/cb\_0"  
    android:layout\_alignLeft="@+id/cb\_0"  
    android:layout\_marginLeft="40dp"  
    android:textSize="20dp"  
    android:text="本人或家人正在集中隔离" />  
<CheckBox  
    android:id="@+id/cb\_3"  
    android:layout\_width="wrap\_content"  
    android:layout\_height="wrap\_content"  
    android:layout\_alignBaseline="@+id/cb\_0"  
    android:layout\_alignBottom="@+id/cb\_0"  
    android:layout\_alignLeft="@+id/cb\_0"  
    android:layout\_marginLeft="40dp"  
    android:textSize="20dp"  
    android:text="本人或家人有出现发热症状" />  
<CheckBox  
    android:id="@+id/cb\_4"  
    android:layout\_width="wrap\_content"  
    android:layout\_height="wrap\_content"  
    android:layout\_alignBaseline="@+id/cb\_0"  
    android:layout\_alignBottom="@+id/cb\_0"  
    android:layout\_alignLeft="@+id/cb\_0"  
    android:layout\_marginLeft="40dp"  
    android:textSize="20dp"  
    android:text="居住地改变" />

<Button  
    android:id="@+id/btn\_add"  
    android:layout\_width="166dp"  
    android:layout\_height="38dp"  
    android:layout\_below="@+id/cbSing"  
    android:layout\_centerHorizontal="true"  
    android:layout\_marginLeft="120dp"  
    android:layout\_marginTop="36dp"  
    android:onClick="onClick"  
    android:text="确定"  
    android:textSize="10dp" />  

activity_register.xml




    <TextView  
        android:id="@+id/tv\_registeractivity\_register"  
        android:layout\_width="wrap\_content"  
        android:layout\_height="wrap\_content"  
        android:text="注册"  
        android:textColor="#fff"  
        android:textSize="20dp"  
        android:layout\_toRightOf="@+id/iv\_registeractivity\_back"  
        android:layout\_centerVertical="true"  
        android:layout\_marginLeft="20dp"  
        />  
</RelativeLayout>

<LinearLayout  
    android:id="@+id/ll\_registeractivity\_body"  
    android:layout\_width="match\_parent"  
    android:layout\_height="wrap\_content"  
    android:orientation="vertical"  
    android:layout\_below="@+id/rl\_registeractivity\_top"  
    android:layout\_marginTop="10dp"  
    android:layout\_marginLeft="5dp"  
    android:layout\_marginRight="5dp"  
    >  
    <!--  
    具体内容部分  
    -->  
    <LinearLayout  
        android:id="@+id/ll\_loginactivity\_two"  
        android:layout\_width="match\_parent"  
        android:layout\_height="wrap\_content"  
        android:orientation="vertical"  
        android:layout\_below="@+id/rl\_registeractivity\_top"  
        android:layout\_marginTop="10dp"  
        android:layout\_marginLeft="5dp"  
        android:layout\_marginRight="5dp"  
        >  
        <LinearLayout  
            android:layout\_width="match\_parent"  
            android:layout\_height="wrap\_content"  
            android:orientation="horizontal">  
            <EditText  
                android:id="@+id/et\_registeractivity\_name"  
                android:layout\_width="match\_parent"  
                android:layout\_height="wrap\_content"  
                android:hint="姓名"/>  
        </LinearLayout>  
        <LinearLayout  
            android:layout\_width="match\_parent"  
            android:layout\_height="wrap\_content"  
            android:orientation="horizontal">

            <EditText  
                android:layout\_width="match\_parent"  
                android:layout\_height="wrap\_content"  
                android:id="@+id/et\_registeractivity\_id"  
                android:hint="学号"></EditText>  
        </LinearLayout>  
        <LinearLayout  
            android:layout\_width="match\_parent"  
            android:layout\_height="wrap\_content"  
            android:orientation="horizontal">  
            <EditText  
                android:layout\_width="match\_parent"  
                android:layout\_height="wrap\_content"  
                android:id="@+id/et\_registeractivity\_address"  
                android:hint="班级"></EditText>  
        </LinearLayout>  
        <LinearLayout  
            android:layout\_width="match\_parent"  
            android:layout\_height="wrap\_content"  
            android:orientation="horizontal">  
            <EditText  
                android:layout\_width="match\_parent"  
                android:layout\_height="wrap\_content"  
                android:id="@+id/et\_registeractivity\_phone"  
                android:hint="手机号码"></EditText>  
        </LinearLayout>

    </LinearLayout>  
    <!-- 验证码部分 -->  
    <LinearLayout  
        android:layout\_width="match\_parent"  
        android:layout\_height="wrap\_content"  
        android:layout\_marginRight="15dp"  
        android:layout\_marginTop="10dp"  
        android:orientation="horizontal" >  
        <!-- 第四个文本编辑框  输入验证码 -->  
        <LinearLayout  
            android:layout\_width="match\_parent"  
            android:layout\_height="wrap\_content"  
            android:orientation="horizontal">  
            <TextView  
                android:id="@+id/tv\_registeractivity\_phoneCodes"  
                android:layout\_width="wrap\_content"  
                android:layout\_height="wrap\_content"  
                android:layout\_marginRight="15dp"  
                android:text="验证码:"/>  
            <EditText  
                android:id="@+id/et\_registeractivity\_phoneCodes"  
                android:layout\_width="0dp"  
                android:layout\_weight="3"  
                android:layout\_height="50dp"  
                android:layout\_marginLeft="10dp"  
                android:layout\_marginRight="10dp"  
                android:hint="请输入4位验证码" />

            <ImageView  
                android:id="@+id/iv\_registeractivity\_showCode"  
                android:layout\_width="0dp"  
                android:layout\_height="70dp"  
                android:layout\_weight="1.5"  
                android:clickable="true"  
                android:onClick="onClick"  
                android:layout\_marginTop="-10dp"  
                />  
        </LinearLayout>  
    </LinearLayout>  
    <!-- 注册按钮 -->  
    <Button  
        android:id="@+id/bt\_registeractivity\_register"  
        android:layout\_width="match\_parent"  
        android:layout\_height="50dp"  
        android:layout\_marginLeft="5dp"  
        android:background="@drawable/selector\_loginactivity\_button"  
        android:textColor="#fff"  
        android:text="注册"  
        android:onClick="onClick"  
        android:layout\_marginTop="40dp"  
        />

    <RelativeLayout  
        android:layout\_width="match\_parent"  
        android:layout\_height="50dp"  
        android:id="@+id/rl\_registeractivity\_bottom"  
        android:layout\_marginTop="10dp"  
        >  
        <TextView  
            android:layout\_centerInParent="true"  
            android:text="注册即代表同意《用户协议》"  
            android:layout\_width="wrap\_content"  
            android:layout\_height="wrap\_content"/>  
    </RelativeLayout>

</LinearLayout>

activity_second.xml


<TextView  
    android:layout\_width="wrap\_content"  
    android:layout\_height="wrap\_content"  
    android:layout\_marginStart="171dp"  
    android:layout\_marginLeft="171dp"  
    android:layout\_marginTop="356dp"  
    android:layout\_marginEnd="212dp"  
    android:layout\_marginRight="212dp"  
    android:layout\_marginBottom="356dp"  
    android:rotation="24"  
    android:rotationX="174"  
    android:rotationY="-137"  
    android:text="two"  
    app:layout\_constraintBottom\_toBottomOf="parent"  
    app:layout\_constraintEnd\_toEndOf="parent"  
    app:layout\_constraintStart\_toStartOf="parent"  
    app:layout\_constraintTop\_toTopOf="parent" />

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器