Android Studio 学生课程签到系统

b1fd64326642479ba92956653c419a07.png

目录

 一、登录界面

二、新用户注册界面

 三、忘记密码界面

 四、用户信息界面

五、课程签到界面


 学生签到系统通过账号密码登录,如果没有账号可以通过注册来创建一个新用户,如果是忘记了密码也可以通过忘记密码来找回密码(因为这个系统我没有连接数据库,创建新用户和找回密码是无法实现的),登录成功后就可以看到个人用户信息,然后对相应的课程进行签到。

 一、登录界面

<TextView
        android:id="@+id/tv_1_Login"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:text="2022年4月18日物联网201考勤情况:李x迟到,李x旷课,李x上课睡觉"
        android:textSize="35dp"
        android:background="#F40202"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit="marquee_forever"
        android:focusable="true"
        android:focusableInTouchMode="true"
        />
    <TextView
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:text="物联网201考勤系统"
        android:textSize="45dp"
        android:gravity="center"
        android:textColor="#F60909"
        android:layout_marginTop="50dp"
        />

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:layout_gravity="center"
        android:layout_marginTop="130dp"
        >
        <TextView
            android:id="@+id/tv_2_Login"
            android:layout_width="wrap_content"
            android:layout_height="32dp"
            android:text="账号:"
            android:textSize="20dp"
            android:gravity="center"
            android:layout_marginTop="2dp"
            />

        <EditText
            android:id="@+id/et_1_Login"
            android:layout_width="160dp"
            android:layout_height="40dp"
            android:layout_marginTop="2dp"
            android:layout_toRightOf="@id/tv_2_Login"
            android:gravity="center"
            android:hint="手机号或邮箱"
            android:textSize="15dp" />

        <TextView
            android:id="@+id/tv_3_Login"
            android:layout_width="wrap_content"
            android:layout_height="32dp"
            android:layout_below="@id/tv_2_Login"
            android:layout_marginTop="14dp"
            android:gravity="center"
            android:text="密码:"
            android:textSize="20dp" />

        <EditText
            android:id="@+id/et_2_Login"
            android:layout_width="160dp"
            android:layout_height="40dp"
            android:layout_below="@id/tv_2_Login"
            android:layout_marginTop="14dp"
            android:layout_toRightOf="@id/tv_3_Login"
            android:gravity="center"
            android:textSize="15dp" />

        <Button
            android:id="@+id/bt_1_Login"
            android:layout_width="wrap_content"
            android:layout_height="50dp"
            android:layout_below="@id/tv_3_Login"
            android:layout_marginLeft="90dp"
            android:layout_marginTop="20dp"
            android:background="@drawable/bt_1_solid_blue"
            android:gravity="center"
            android:text="登录"
            android:textSize="27dp" />

        <Button
            android:id="@+id/bt_2_Login"
            android:layout_width="65dp"
            android:layout_height="32dp"
            android:layout_toRightOf="@id/et_1_Login"
            android:background="@drawable/bt_2_solid_yellow"
            android:text="注册"
            android:textSize="15dp"
            />

        <Button
            android:id="@+id/bt_3_Login"
            android:layout_width="67dp"
            android:layout_height="32dp"
            android:layout_below="@id/bt_2_Login"
            android:layout_marginTop="15dp"
            android:layout_toRightOf="@id/et_2_Login"
            android:background="@drawable/bt_3_stroke_yellow"
            android:text="忘记密码"
            android:textSize="15dp" />

        <CheckBox
            android:id="@+id/cb_1_Login"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/bt_1_Login"
            android:layout_marginLeft="65dp"
            android:layout_marginTop="90dp"
            android:background="@drawable/cb_1_stroke_blue"
            android:checked="true"
            android:text="我同意《xxx协议》"
            android:textColor="#9F9D9D"
            android:textSize="12dp" />
    </RelativeLayout>

public class Login_Screen extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login_screen);
        CheckBox cb_1_Login=findViewById(R.id.cb_1_Login);//复选框,在xml里面我设置为默认勾选
        cb_1_Login.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);//设置下划线
        TextView tv_1=findViewById(R.id.tv_1_Login);
        tv_1.setSelected(true);//设置跑马灯效果

        String user="admin";//设置用户名
        String passorward="123456";//设置密码
        EditText et_1_Login=findViewById(R.id.et_1_Login);//连接的是用户名编辑框
        EditText et_2_Login=findViewById(R.id.et_2_Login);//连接的是密码编辑框
        Button bt_1=findViewById(R.id.bt_1_Login);//连接的是登录按钮
        bt_1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (cb_1_Login.isChecked()){
                    String user_code = et_1_Login.getText().toString();//获取输入的用户名
                    String passorward_code = et_2_Login.getText().toString();//获取输入的密码
                    if (user_code.isEmpty()){
                        Toast.makeText(Login_Screen.this,"请输入账号",Toast.LENGTH_SHORT).show();
                    }else {
                        if (passorward_code.isEmpty()){
                            Toast.makeText(Login_Screen.this,"请输入密码",Toast.LENGTH_SHORT).show();
                        }else {
                            if (user_code.equals(user)){
                                if (passorward_code.equals(passorward)){
                                    Intent intent = new Intent(Login_Screen.this, User_Screen.class);
                                    startActivity(intent);
                                }else {
                                    Toast.makeText(Login_Screen.this,"密码错误,请重新输入",Toast.LENGTH_SHORT).show();
                                }
                            }else {
                                Toast.makeText(Login_Screen.this,"账号错误,请重新输入",Toast.LENGTH_SHORT).show();
                            }
                        }
                    }
                }else {
                    Toast.makeText(Login_Screen.this,"请勾选协议",Toast.LENGTH_SHORT).show();
                }
            }
        });
        Button bt_2_Login=findViewById(R.id.bt_2_Login);//注册按钮的监听
        bt_2_Login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Login_Screen.this, Registered.class);
                startActivity(intent);
            }
        });

        Button bt_3_Login=findViewById(R.id.bt_3_Login);//忘记密码按钮的监听
        bt_3_Login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Login_Screen.this, Forgot_Password.class);
                startActivity(intent);
            }
        });
    }
}

 我的登录系统是必须用户和密码以及勾选了用户协议才能登录成功

二、新用户注册界面

f06562cc1d4d4bce95e5c0ceffb68cf2.png

<TextView
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:text="新用户注册界面"
        android:background="#A6F0FA"
        android:textSize="40dp"
        android:gravity="center"
        android:layout_gravity="center"

        ></TextView>
<RelativeLayout
    android:layout_width="300dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginTop="40dp"
    >
    <TextView
        android:id="@+id/tv_1_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="        昵称:"
        android:textSize="20dp"
        android:layout_marginTop="5dp"
        ></TextView>

    <EditText
        android:id="@+id/et_1_Registered"
        android:layout_width="168dp"
        android:layout_height="40dp"
        android:layout_marginLeft="10dp"
        android:layout_toRightOf="@id/tv_1_Registered"
        android:background="@drawable/ed_1_stroke_blue"></EditText>
    <TextView
        android:id="@+id/tv_2_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="        性别:"
        android:textSize="20dp"
        android:layout_below="@id/tv_1_Registered"
        android:layout_marginTop="5dp"
        ></TextView>

    <RadioGroup
        android:id="@+id/rg_1_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:layout_below="@id/et_1_Registered"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        android:layout_toRightOf="@id/tv_2_Registered"
        android:orientation="horizontal">

        <RadioButton
            android:id="@+id/rb_1_Registered"
            android:layout_width="40dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="3dp"
            android:background="@drawable/rb_1_solid_blue"
            android:button="@null"
            android:gravity="center"
            android:text="男"
            android:textSize="20dp"></RadioButton>

        <RadioButton
            android:id="@+id/rb_2_Registered"
            android:layout_width="40dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="62dp"
            android:background="@drawable/rb_1_solid_blue"
            android:button="@null"
            android:gravity="center"
            android:text="女"
            android:textSize="20dp"></RadioButton>
    </RadioGroup>
    <TextView
        android:id="@+id/tv_3_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="        密码:"
        android:textSize="20dp"
        android:layout_below="@id/tv_2_Registered"
        android:layout_marginTop="5dp"
        ></TextView>

    <EditText
        android:id="@+id/et_2_Registered"
        android:layout_width="168dp"
        android:layout_height="40dp"
        android:layout_below="@id/rg_1_Registered"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        android:layout_toRightOf="@id/tv_3_Registered"
        android:background="@drawable/ed_1_stroke_blue"></EditText>

    <TextView
        android:id="@+id/tv_4_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:layout_below="@id/tv_3_Registered"
        android:layout_marginTop="5dp"
        android:text="确认密码:"
        android:layout_marginLeft="0dp"
        android:textSize="20dp"></TextView>

    <EditText
        android:id="@+id/et_3_Registered"
        android:layout_width="168dp"
        android:layout_height="40dp"
        android:layout_below="@id/et_2_Registered"
        android:layout_marginLeft="9dp"
        android:layout_marginTop="5dp"
        android:layout_toRightOf="@id/tv_4_Registered"
        android:background="@drawable/ed_1_stroke_blue"></EditText>
    <TextView
        android:id="@+id/tv_5_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="    手机号:"
        android:textSize="20dp"
        android:layout_below="@id/tv_4_Registered"
        android:layout_marginTop="5dp"
        ></TextView>

    <EditText
        android:id="@+id/et_4_Registered"
        android:layout_width="168dp"
        android:layout_height="40dp"
        android:layout_below="@id/et_3_Registered"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        android:layout_toRightOf="@id/tv_5_Registered"
        android:background="@drawable/ed_1_stroke_blue"></EditText>
    <TextView
        android:id="@+id/tv_6_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="    验证码:"
        android:textSize="20dp"
        android:layout_below="@id/tv_5_Registered"
        android:layout_marginTop="5dp"
        ></TextView>
    <EditText
        android:id="@+id/et_5_Registered"
        android:layout_width="168dp"
        android:layout_height="40dp"
        android:layout_below="@id/et_4_Registered"
        android:layout_toRightOf="@id/tv_6_Registered"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        android:background="@drawable/ed_1_stroke_blue"
        ></EditText>
    <TextView
        android:id="@+id/tv_10_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="        邮箱:"
        android:textSize="20dp"
        android:layout_below="@id/tv_6_Registered"
        android:layout_marginTop="5dp"
        ></TextView>

    <EditText
        android:id="@+id/et_6_Registered"
        android:layout_width="168dp"
        android:layout_height="40dp"
        android:layout_below="@id/et_5_Registered"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        android:layout_toRightOf="@id/tv_10_Registered"
        android:background="@drawable/ed_1_stroke_blue"></EditText>
    <TextView
        android:id="@+id/tv_11_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="出生日期:"
        android:textSize="20dp"
        android:layout_below="@id/tv_10_Registered"
        android:layout_marginTop="5dp"
        ></TextView>

    <EditText
        android:id="@+id/et_7_Registered"
        android:layout_width="168dp"
        android:layout_height="40dp"
        android:layout_below="@id/et_6_Registered"
        android:layout_marginLeft="9dp"
        android:layout_marginTop="5dp"
        android:layout_toRightOf="@id/tv_11_Registered"
        android:background="@drawable/ed_1_stroke_blue"
        ></EditText>

    <Button
        android:id="@+id/bt_1_Registered"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/et_7_Registered"
        android:layout_marginLeft="110dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/bt_1_solid_blue"
        android:text="立即注册"
        android:textSize="30dp"></Button>
    <TextView
        android:id="@+id/tv_7_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="*"
        android:textSize="30dp"
        android:textColor="#FB0000"
        android:gravity="center"
        android:layout_toRightOf="@id/et_1_Registered"
        android:layout_marginLeft="10dp"
        ></TextView>
    <TextView
        android:id="@+id/tv_8_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="*"
        android:textSize="30dp"
        android:textColor="#FB0000"
        android:gravity="center"
        android:layout_below="@id/tv_7_Registered"
        android:layout_toRightOf="@id/et_2_Registered"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        ></TextView>
    <TextView
        android:id="@+id/tv_9_Registered"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="*"
        android:textSize="30dp"
        android:textColor="#FB0000"
        android:gravity="center"
        android:layout_below="@id/tv_4_Registered"
        android:layout_toRightOf="@id/et_4_Registered"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        ></TextView>
    <TextView
        android:id="@+id/tv_12_Registered"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/bt_1_Registered"
        android:layout_marginLeft="124dp"
        android:layout_marginTop="5dp"
        android:text="带*项为必填项"
        android:textColor="#9F9D9D"
        android:textSize="15dp"></TextView>

    <CheckBox
        android:id="@+id/cb_1_Registered"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/tv_12_Registered"
        android:layout_marginLeft="95dp"
        android:checked="true"
        android:text="我同意《xxx协议》"
        android:textSize="15dp"
        android:background="@drawable/cb_1_stroke_blue"
        ></CheckBox>
</RelativeLayout>

public class Registered extends AppCompatActivity {

    @RequiresApi(api = Build.VERSION_CODES.S)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_registered);
        TextView tv_12_Registered = findViewById(R.id.tv_12_Registered);
        tv_12_Registered.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
        RadioButton rb_1_Registered=findViewById(R.id.rb_1_Registered);
        RadioButton rb_2_Registered=findViewById(R.id.rb_2_Registered);
        Button bt_1_Registered=findViewById(R.id.bt_1_Registered);
        CheckBox cb_1_Registered=findViewById(R.id.cb_1_Registered);
        EditText et_1_Registered=findViewById(R.id.et_1_Registered);
        EditText et_2_Registered=findViewById(R.id.et_2_Registered);
        EditText et_3_Registered=findViewById(R.id.et_3_Registered);
        EditText et_4_Registered=findViewById(R.id.et_4_Registered);
        EditText et_5_Registered=findViewById(R.id.et_5_Registered);
        EditText et_6_Registered=findViewById(R.id.et_6_Registered);
        EditText et_7_Registered=findViewById(R.id.et_7_Registered);

        bt_1_Registered.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (cb_1_Registered.isChecked()){
                    String name = et_1_Registered.getText().toString();
                    String phonenumber = et_4_Registered.getText().toString();
                    Log.e("昵称",name);
                    if (rb_1_Registered.isChecked()){
                        Log.e("性别",rb_1_Registered.getText().toString());
                    }else if(rb_2_Registered.isChecked()){
                        Log.e("性别",rb_2_Registered.getText().toString());
                    }
                    Log.e("密码",et_2_Registered.getText().toString());
                    Log.e("确认密码",et_3_Registered.getText().toString());
                    Log.e("手机号",phonenumber);
                    Log.e("验证码",et_5_Registered.getText().toString());
                    Log.e("邮箱",et_6_Registered.getText().toString());
                    Log.e("出生日期",et_7_Registered.getText().toString());
                    if ((rb_1_Registered.isChecked()||rb_2_Registered.isChecked())&&!name.isEmpty()&&!phonenumber.isEmpty()){
                        Intent intent = new Intent(Registered.this, Successful_Registration.class);
                        startActivity(intent);
                    }else{
                        Toast.makeText(Registered.this,"带*项为必填项",Toast.LENGTH_SHORT).show();
                    }
                }else {
                    Toast.makeText(Registered.this,"请勾选协议",Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}

 我将新用户注册界面的带*项设置为必填项,如果不需要设为必填项就将if((rb_1_Registered.isChecked()||rb_2_Registered.isChecked())&&!name.isEmpty()&&!phonenumber.isEmpty())这个if语句去掉,直接写跳转语句就行了

因为没有连接数据库,所以编辑框的内容无法保存,我直接用了Log显现出来了。

 三、忘记密码界面

7193ee44faab45a7b438ec80b8f892bb.png

 <TextView
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:text="忘记密码界面"
        android:textSize="40dp"
        android:gravity="center"
        android:background="#90CFEC"
        />
    <RadioGroup
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_marginTop="100dp"
        android:layout_gravity="center"
        >

        <RadioButton
            android:id="@+id/rb_1_Password"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:text="邮箱验证"
            android:textSize="25dp"
            android:layout_marginTop="10dp"
            android:background="@drawable/cb_2_solid"
            />
        <RadioButton
            android:id="@+id/rb_2_Password"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:text="手机验证"
            android:textSize="25dp"
            android:layout_marginTop="30dp"
            android:background="@drawable/cb_2_solid"
            />
        <RadioButton
            android:id="@+id/rb_3_Password"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:text="密保验证"
            android:textSize="25dp"
            android:layout_marginTop="30dp"
            android:background="@drawable/cb_2_solid"
            />

    </RadioGroup>
    <Button
        android:id="@+id/bt_1_Password"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="确认"
        android:textSize="40dp"
        android:layout_marginLeft="160dp"
        android:layout_marginTop="40dp"
        android:background="@drawable/bt_1_solid_blue"
        />

public class Forgot_Password extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_forgot_password);
        RadioButton rb_1_Password=findViewById(R.id.rb_1_Password);//邮箱验证单选按钮
        RadioButton rb_2_Password=findViewById(R.id.rb_2_Password);//短信验证单选按钮
        RadioButton rb_3_Password=findViewById(R.id.rb_3_Password);//密保问题验证单选按钮
        Button bt_1=findViewById(R.id.bt_1_Password);
        bt_1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (rb_1_Password.isChecked())
                {
                    Intent intent = new Intent(Forgot_Password.this, Email_Verification.class);
                    startActivity(intent);
                }else if (rb_2_Password.isChecked()){
                    Intent intent = new Intent(Forgot_Password.this, Message_Verification.class);
                    startActivity(intent);
                }else if (rb_3_Password.isChecked()){
                    Intent intent = new Intent(Forgot_Password.this, Secret_Verification.class);
                    startActivity(intent);
                }
            }
        });
    }
}

 按钮我用的是Radiobutton单选按钮,因为用到了三个单选按钮,我又用到了RadioGroup来装单选按钮,RadioGroup组的用法就是,里面的单选按钮只能有一个按钮别选中,如果没有用RadioGroup组的话,可以理解为一个单独的RadioButton就是一个RadioGroup,那么三个RadioButton就是三个RadioGroup,那就是三个RadioButton又可以同时选中。

 四、用户信息界面

b8160f9bfad741c8ab3b71bab5818e3b.jpeg

<TextView
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:text="用户信息界面"
        android:textSize="35dp"
        android:gravity="center"
        android:background="#8DCEEC"
        />
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginLeft="30dp"
        android:layout_marginTop="40dp"
        >

        <ImageView
            android:id="@+id/iv_1_user"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_marginLeft="90dp"
            android:scaleType="centerInside"
            android:src="@drawable/head_photo" />

        <TextView
            android:id="@+id/tv_1_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:text="用  户  名:"
            android:textSize="20dp"
            android:layout_marginLeft="50dp"
            android:layout_below="@id/iv_1_user"
            android:layout_marginTop="20dp"
            />

        <TextView
            android:id="@+id/tv_2_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_marginLeft="20dp"
            android:layout_toRightOf="@id/tv_1_user"
            android:text="张三"
            android:textSize="20dp"
            android:layout_below="@id/iv_1_user"
            android:layout_marginTop="20dp"
            />

        <TextView
            android:id="@+id/tv_15_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_1_user"
            android:layout_marginTop="10dp"
            android:text="性        别:"
            android:textSize="20dp"
            android:layout_marginLeft="50dp"
            />

        <TextView
            android:id="@+id/tv_16_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_2_user"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp"
            android:layout_toRightOf="@id/tv_15_user"
            android:text="男"
            android:textSize="20dp"/>

        <TextView
            android:id="@+id/tv_3_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_13_user"
            android:layout_marginTop="10dp"
            android:text="个性签名:"
            android:textSize="20dp"
            android:layout_marginLeft="50dp"/>

        <TextView
            android:id="@+id/tv_4_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_14_user"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp"
            android:layout_toRightOf="@id/tv_3_user"
            android:text="憨批"
            android:textSize="20dp" />

        <TextView
            android:id="@+id/tv_5_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_15_user"
            android:layout_marginTop="10dp"
            android:text="星        座:"
            android:textSize="20dp"
            android:layout_marginLeft="50dp"/>

        <TextView
            android:id="@+id/tv_6_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_16_user"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp"
            android:layout_toRightOf="@id/tv_3_user"
            android:text="射手座"
            android:textSize="20dp"/>

        <TextView
            android:id="@+id/tv_7_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_5_user"
            android:layout_marginTop="10dp"
            android:text="爱        好:"
            android:textSize="20dp"
            android:layout_marginLeft="50dp"/>

        <TextView
            android:id="@+id/tv_8_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_6_user"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp"
            android:layout_toRightOf="@id/tv_7_user"
            android:text="吃饭睡觉打豆豆"
            android:textSize="20dp"
            />

        <TextView
            android:id="@+id/tv_9_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_11_user"
            android:layout_marginTop="10dp"
            android:text="绑定手机:"
            android:textSize="20dp"
            android:layout_marginLeft="50dp"
            />

        <TextView
            android:id="@+id/tv_10_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_12_user"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp"
            android:layout_toRightOf="@id/tv_9_user"
            android:text="17758779139"
            android:textSize="20dp"
            />

        <TextView
            android:id="@+id/tv_11_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_7_user"
            android:layout_marginTop="10dp"
            android:text="生        日:"
            android:textSize="20dp"
            android:layout_marginLeft="50dp"
            />

        <TextView
            android:id="@+id/tv_12_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_8_user"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp"
            android:layout_toRightOf="@id/tv_11_user"
            android:text="11-10"
            android:textSize="20dp"/>

        <TextView
            android:id="@+id/tv_13_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_9_user"
            android:layout_marginTop="10dp"
            android:text="所在城市:"
            android:textSize="20dp"
            android:layout_marginLeft="50dp"/>

        <TextView
            android:id="@+id/tv_14_user"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_below="@id/tv_10_user"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp"
            android:layout_toRightOf="@id/tv_13_user"
            android:text="江西 萍乡"
            android:textSize="20dp"/>


        <Button
            android:id="@+id/bt_1_user"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/tv_4_user"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="20dp"
            android:background="@drawable/bt_5_solid_blue"
            android:text="编辑个人信息" />

        <Button
            android:id="@+id/bt_2_user"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/tv_4_user"
            android:layout_marginLeft="15dp"
            android:layout_marginTop="20dp"
            android:layout_toRightOf="@id/bt_3_user"
            android:background="@drawable/bt_5_solid_blue"
            android:text="签到"
            android:textSize="20dp" />

        <Button
            android:id="@+id/bt_3_user"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/tv_4_user"
            android:layout_marginLeft="15dp"
            android:layout_marginTop="20dp"
            android:layout_toRightOf="@id/bt_1_user"
            android:background="@drawable/bt_5_solid_blue"
            android:text="日期查询"
            android:textSize="20dp"/>
    </RelativeLayout>

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_screen);
        Button bt_1_user=findViewById(R.id.bt_1_user);
        bt_1_user.setOnClickListener(new View.OnClickListener() {//修改个人信息按钮监听
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(User_Screen.this, Renew_Message.class);
                startActivity(intent);
            }
        });
        Button bt_2_user=findViewById(R.id.bt_2_user);
        bt_2_user.setOnClickListener(new View.OnClickListener() {//签到按钮监听
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(User_Screen.this, Sig_in.class);
                startActivity(intent);
            }
        });

        Intent intent=getIntent();
        TextView textView=findViewById(R.id.tv_4_user);
        textView.setText(intent.getStringExtra("Extra_message"));

        Button bt_3_user=findViewById(R.id.bt_3_user);
        bt_3_user.setOnClickListener(new View.OnClickListener() {//查询时间按钮监听
            @Override
            public void onClick(View view) {
                Intent intent1 = new Intent(User_Screen.this, Data_find.class);
                startActivity(intent1);
            }
        });
    }
}

个人信息界面和注册界面十分相似,就是将文本显现出来就ok了,我还额外写了一个修改用户信息按钮和查询日期按钮,因为还是没有连接数据库我就不呈现了

五、课程签到界面

318dc55c9f7044b2a9c19e18675eb892.png

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
        <TextView
            android:id="@+id/tv_5_sign"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:gravity="center"
            android:text="物联网201签到界面"
            android:textColor="#99000000"
            android:textSize="35dp" />

        <TextView
            android:id="@+id/tv_1_sign"
            android:layout_width="60dp"
            android:layout_height="40dp"
            android:layout_marginLeft="30dp"
            android:text="课程:"
            android:textSize="25dp"
            android:layout_below="@id/tv_5_sign"
            android:layout_marginTop="40dp"
            />

        <Spinner
            android:id="@+id/sp_1_sign"
            android:layout_width="180dp"
            android:layout_height="40dp"
            android:layout_below="@id/tv_5_sign"
            android:layout_marginTop="40dp"
            android:layout_toRightOf="@id/tv_1_sign"
            android:gravity="center"
            android:popupBackground="@drawable/sp_1_solid"
            android:scrollbarSize="30dp" />

        <TextView
            android:id="@+id/tv_2_sign"
            android:layout_width="60dp"
            android:layout_height="40dp"
            android:layout_below="@id/tv_1_sign"
            android:layout_marginLeft="30dp"
            android:layout_marginTop="5dp"
            android:text="课时:"
            android:textSize="25dp"
            />

        <Spinner
            android:id="@+id/sp_2_sign"
            android:layout_width="180dp"
            android:layout_height="40dp"
            android:layout_below="@id/sp_1_sign"
            android:layout_toRightOf="@id/tv_2_sign"
            android:popupBackground="@drawable/sp_1_solid"
            android:gravity="center"
            android:scrollbarSize="30dp" />

        <TextView
            android:id="@+id/tv_4_sign"
            android:layout_width="60dp"
            android:layout_height="40dp"
            android:text="日期:"
            android:textSize="25dp"
            android:layout_below="@id/tv_2_sign"
            android:layout_marginLeft="30dp"
            android:layout_marginTop="5dp"
            />

        <TextView
            android:id="@+id/tv_3_sign"
            android:layout_width="150dp"
            android:layout_height="40dp"
            android:textSize="25dp"
            android:layout_below="@id/tv_2_sign"
            android:layout_toRightOf="@id/tv_4_sign"
            android:layout_marginTop="5dp"
            />

        <ImageView
            android:layout_width="90dp"
            android:layout_height="100dp"
            android:layout_marginLeft="280dp"
            android:layout_marginTop="60dp"
            android:src="@drawable/smile"
            tools:visibility="visible" />

        <LinearLayout
            android:id="@+id/L_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/tv_4_sign"
            android:orientation="horizontal"
            >
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:text="距毕业还有"
                android:textSize="25dp"
                android:layout_marginLeft="30dp"
                />
            <TextView
                android:id="@+id/tv_6_sign"
                android:layout_width="wrap_content"
                android:layout_height="50dp"
                android:text=" 99 "
                android:textSize="33dp"
                android:textColor="#FF0000"
                />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:text="天"
                android:textSize="25dp"
                />
        </LinearLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_below="@id/L_1"
            android:gravity="center"
            android:text="拼一个春夏秋冬,换一生无怨无悔"
            android:textSize="25dp"
            android:layout_marginTop="10dp"
            />
    </RelativeLayout>
    <Button
        android:id="@+id/bt_1_sig"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_marginTop="80dp"
        android:layout_marginLeft="100dp"
        android:background="@drawable/bt_6_solid_round_blue"
        android:text="签到"
        android:textSize="80dp"
        android:textColor="#117380"
        />

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_in);
        Spinner sp_1_sign=findViewById(R.id.sp_1_sign);
        Spinner sp_2_sign=findViewById(R.id.sp_2_sign);

        String []subject={"未选","Java物联网程序设计","C语言设计","无线组网技术","大学生体育","UI移动设计"};
        String []time={"未选","1-2节","3-4节","课外一","5-6节","7-8节","课外二"};
        ArrayAdapter arrayAdapter1=new ArrayAdapter(this, android.R.layout.simple_spinner_item,subject);
        sp_1_sign.setAdapter(arrayAdapter1);

        ArrayAdapter arrayAdapter2 = new ArrayAdapter(this, android.R.layout.simple_spinner_item, time);
        sp_2_sign.setAdapter(arrayAdapter2);

        Date date = new Date();
        SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd");
        TextView textView=findViewById(R.id.tv_3_sign);
        textView.setText(dateFormat.format(date));
        Button bt_1_sig=findViewById(R.id.bt_1_sig);

        sp_1_sign.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
                String subject = adapterView.getItemAtPosition(i).toString();
                Log.e("课程",subject);
                bt_1_sig.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        if (subject.equals("未选")){
                            Toast.makeText(Sig_in.this,"未选择课程",Toast.LENGTH_SHORT).show();
                        }else{
                            sp_2_sign.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                                @Override
                                public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
                                    String time = adapterView.getItemAtPosition(i).toString();
                                    Log.e("课时",time);
                                    if (time.equals("未选")){
                                        Toast.makeText(Sig_in.this,"未选择课时",Toast.LENGTH_SHORT).show();
                                    }else {
                                        bt_1_sig.setOnClickListener(new View.OnClickListener() {
                                            @Override
                                            public void onClick(View view) {
                                                Intent intent = new Intent(Sig_in.this,Successful_Sig_In.class);
                                                startActivity(intent);
                                            }
                                        });
                                    }
                                }

                                @Override
                                public void onNothingSelected(AdapterView<?> adapterView) {

                                }
                            });
                        }
                    }
                });
            }

            @Override
            public void onNothingSelected(AdapterView<?> adapterView) {

            }
        });
        TextView tv_6_sign=findViewById(R.id.tv_6_sign);
        tv_6_sign.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
    }

课程和课时我用的Spinner控件(它的作用也和单选按钮类似),就是一个简单的下拉框,我们可以自定义设置里面的内容,他的用法就是给Spinner控件添加一个适配器,然后再设置一个监听,就可以知道用户选的是下拉框里哪一项内容了。  

  • 7
    点赞
  • 93
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 9
    评论
【资源说明】 1、该项目是个人毕设项目源码,评审分达到95分,都经过严格调试,确保可以运行!放心下载使用。 该项目资源主要针对计算机、自动化等相关专业的学生或从业者下载使用,也可作为期末课程设计、课程大作业、毕业设计等。 2、具有较高的学习借鉴价值!基础能力强的可以在此基础上修改调整,以实现类似其他功能。 开发软件:Idea + Mysql + AndroidStudio + 安卓手机 开发技术:Springboot + 原生Android + 百度智能云台人脸搜索接口 基于安卓开发一个学生人脸识别课程考勤签到系统,主要是给学校老师方便统计自己上课的考勤情况。老师可以注册自己的账号,web端登录后可以添加和管理学生信息,学生信息里面包括了学生的人脸图像,添加的时候人脸照片会同步上传到百度智能云平台的人脸库,老师可以查询自己课程的考勤签到记录,也可以查询某个学生签到记录;安卓端采用studio开发,手机端老师登录后可以选择自己的课程安排上课时间和地点,当上课的时候可以拿出手机拍摄学生的脸部图像,然后将学生人脸图像传给服务器端,服务器利用学生人脸数据提交给百度云的人脸搜索识别接口查询在学生人脸库里面是否存在,如果查询成功就可以登记该学生的考勤签到记录。 web端登录地址:http://localhost:8080/login.html 老师账号密码:TH001/123456

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小新不吃辣

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值