第三次作业

第三次作业,第1张

概述<?xmlversion="1.0"encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apkes/android"android:layout_width="match_parent"android:layout_height="match_parent"a
<?xml version="1.0" enCoding="utf-8"?><relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:background="#ffffff">    <linearLayout        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:layout_margintop="30dp"        androID:orIEntation="vertical"        androID:padding="30dp">        <TextVIEw            androID:ID="@+ID/text1"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:text="QQ"            androID:textSize="40sp" />        <EditText            androID:ID="@+ID/edt1"            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent"            androID:layout_margintop="35dp"            androID:hint="QQ号/邮箱/手机号" />        <EditText            androID:ID="@+ID/edt2"            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent"            androID:hint="密码"            androID:password="true"/>        <relativeLayout            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:layout_margintop="10dp">            <TextVIEw                androID:ID="@+ID/text2"                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:text="忘记密码?"                androID:textcolor="#00aaff" />            <TextVIEw                androID:ID="@+ID/text3"                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:layout_alignParentRight="true"                androID:text="新用户注册"                androID:textcolor="#00aaff" />        </relativeLayout>        <button            androID:ID="@+ID/btn1"            androID:layout_wIDth="match_parent"            androID:layout_margin="10dp"            androID:layout_height="40dp"            androID:text="登录"            androID:textSize="20sp"            androID:background="#87CEFF"            androID:onClick="click"            />    </linearLayout>    <TextVIEw        androID:ID="@+ID/text4"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:layout_alignParentBottom="true"        androID:layout_marginBottom="30dp"        androID:text="登陆即代表阅读并同意"        androID:layout_marginleft="56dp"        androID:textcolor="#FFFAFA"        androID:textSize="20sp" />    <TextVIEw        androID:ID="@+ID/text5"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:layout_alignParentBottom="true"        androID:layout_toRightOf="@+ID/text4"        androID:layout_marginBottom="30dp"        androID:text="阅读条款"        androID:textcolor="#00aaff"        androID:textSize="20sp" /></relativeLayout>
package com.example.wzrqq;import androIDx.appcompat.app.AppCompatActivity;import androID.os.Bundle;import androID.vIEw.VIEw.OnClickListener;import androID.vIEw.VIEw;import androID.Widget.EditText;import androID.Widget.linearLayout;import androID.Widget.TextVIEw;import androID.Widget.button;import androID.Widget.Toast;public class MainActivity extends AppCompatActivity {    private button btn1;    EditText account = null;    EditText code = null;    EditText t1;    @OverrIDe    protected voID onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentVIEw(R.layout.activity_main);        t1=(EditText) findVIEwByID(R.ID.edt1);        account = (EditText) findVIEwByID(R.ID.edt1);        code = (EditText) findVIEwByID(R.ID.edt2);        btn1=(button) findVIEwByID(R.ID.btn1);        btn1.setonClickListener(new OnClickListener() {            @OverrIDe            public voID onClick(VIEw vIEw) {                String username = ((EditText) findVIEwByID(R.ID.edt1)).getText().toString();                String pwd = ((EditText) findVIEwByID(R.ID.edt2)).getText().toString();                if (username.equals("123456") && pwd.equals("123456")) {                    Toast.makeText(MainActivity.this,"登陆成功",Toast.LENGTH_SHORT).show();                } else {                    t1.setText("账号或密码错误请重新输入");                    Toast.makeText(MainActivity.this,"登陆失败",Toast.LENGTH_SHORT).show();                }            }        });    }}

 

 

 

总结

以上是内存溢出为你收集整理的第三次作业全部内容,希望文章能够帮你解决第三次作业所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1105009.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存