Android学生信息管理系统(1)登录界面设计(1)

本文详细描述了一个Android应用程序中的UI组件配置,如TextView、EditText、CheckBox、ProgressBar和Button的使用,以及如何在MainActivity中进行布局设置和事件监听。内容涉及SharedPreferences的使用和密码保存逻辑。
摘要由CSDN通过智能技术生成

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:hint=" " />

<LinearLayout

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:orientation=“horizontal”>

<TextView

android:textColor=“@color/colorAccent”

android:id=“@+id/password”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:gravity=“end”

android:text=“请输入你的密码:”

android:textSize=“30sp”

android:textStyle=“bold” />

<EditText

android:id=“@+id/input2”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:hint=" " />

<LinearLayout

android:layout_marginTop=“60dp”

android:layout_width=“match_parent”

android:layout_height=“wrap_content”>

<CheckBox

android:layout_height=“wrap_content”

android:id=“@+id/remember_button”

android:layout_width=“wrap_content”

android:layout_marginLeft=“50dp” />

<TextView

android:layout_marginLeft=“60dp”

android:id=“@+id/remember_text”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:textSize=“18sp”

android:text=“是否保存本次密码”

android:textStyle=“bold” />

<ProgressBar

android:layout_marginTop=“20dp”

android:id=“@+id/progress”

android:layout_width=“match_parent”

android:layout_height=“wrap_content”

android:max=“250” />

<Button

android:layout_marginTop=“30dp”

android:id=“@+id/login_button”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginLeft=“120dp”

android:layout_marginRight=“15dp”

android:background=“#add8e6”

android:text=“点击注册进入”

android:textSize=“25sp” />

package com.example.android;

import android.app.Activity;

import android.content.Intent;

import android.content.SharedPreferences;

import android.os.Bundle;

import android.preference.PreferenceManager;

import android.view.View.OnClickListener;

import android.view.View;

import android.widget.Button;

import android.widget.CheckBox;

import android.widget.EditText;

import android.widget.ProgressBar;

import android.widget.Toast;

public class MainActivity extends Activity implements OnClickListener{

Button button;

EditText edit1,edit2;

CheckBox checkbox;

ProgressBar bar;

SharedPreferences pref;

SharedPreferences.Editor editor;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

button=(Button) findViewById(R.id.login_button);

edit1=(EditText) findViewById(R.id.input1);

edit2=(EditText) findViewById(R.id.input2);

checkbox=(CheckBox) findViewById(R.id.remember_button);

bar=(ProgressBar) findViewById(R.id.progress);//进度条

pref= PreferenceManager.getDefaultSharedPreferences(this);

boolean isRemember=pref.getBoolean(“rem”,false); //用于给是否保存密码赋值

if(isRemember) {

//将账号和密码设置到文本框中

String account=pref.getString(“account”,“”);

String password=pref.getString(“password”,“”);

edit1.setText(account);

edit2.setText(password);

checkbox.setChecked(true);

}

button.setOnClickListener(this);

}

@Override

public void onClick(View v){

String account=edit1.getText().toString();

String password=edit2.getText().toString();

if(account.equals(“0417200131”) && password.equals(“123456789”)) {

editor = pref.edit();

if(checkbox.isChecked()) {

editor.putBoolean(“rem”,true);

editor.putString(“account”,account);

editor.putString(“password”,password);
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则近万的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。

img

img

img

img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Android)

分享读者

作者2013年java转到Android开发,在小厂待过,也去过华为,OPPO等大厂待过,18年四月份进了阿里一直到现在。

被人面试过,也面试过很多人。深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长,不成体系的学习效果低效漫长,而且极易碰到天花板技术停滞不前!

我们整理了一份阿里P7级别的Android架构师全套学习资料,特别适合有3-5年以上经验的小伙伴深入学习提升。

主要包括阿里,以及字节跳动,腾讯,华为,小米,等一线互联网公司主流架构技术。如果你有需要,尽管拿走好了。

35岁中年危机大多是因为被短期的利益牵着走,过早压榨掉了价值,如果能一开始就树立一个正确的长远的职业规划。35岁后的你只会比周围的人更值钱。

《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!

,小米,等一线互联网公司主流架构技术。如果你有需要,尽管拿走好了。

[外链图片转存中…(img-fKOMF54l-1713802998177)]

35岁中年危机大多是因为被短期的利益牵着走,过早压榨掉了价值,如果能一开始就树立一个正确的长远的职业规划。35岁后的你只会比周围的人更值钱。

《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值