zoukankan      html  css  js  c++  java
  • 第三次作业

    <?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="@mipmap/p4">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="60dp"
            android:orientation="vertical"
            android:padding="30dp">
            <TextView
                android:id="@+id/text1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="100dp"
                android:drawableLeft="@mipmap/p1"
                android:text="QQ"
                android:textSize="50sp" />
            <EditText
                android:id="@+id/edt1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="35dp"
                android:textSize="30sp"
                android:hint="QQ号/邮箱/手机号" />
            <EditText
                android:id="@+id/edt2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:textSize="30sp"
                android:hint="密码"
                android:password="true"/>
    
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp">
    
            </RelativeLayout>
            <Button
                android:id="@+id/btn1"
                android:layout_width="match_parent"
                android:layout_marginTop="10dp"
                android:layout_height="60dp"
                android:text="登录"
                android:textSize="30sp"
                android:background="#55EEAA"
                android:onClick="click"
                />
        </LinearLayout>
    </RelativeLayout>
    package com.example.myapplication;
    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.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 {
                        Toast.makeText(MainActivity.this,"登陆失败",Toast.LENGTH_SHORT).show();
                    }
                }
    
            });
    
    
        }
    }
    

      

    <?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="@mipmap/p4">
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="60dp"
            android:orientation="vertical"
            android:padding="30dp">
            <TextView
                android:id="@+id/text1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="100dp"
                android:drawableLeft="@mipmap/p1"
                android:text="QQ"
                android:textSize="50sp" />
            <EditText
                android:id="@+id/edt1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="35dp"
                android:textSize="30sp"
                android:hint="QQ号/邮箱/手机号" />
            <EditText
                android:id="@+id/edt2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:textSize="30sp"
                android:hint="密码"
                android:password="true"/>
    
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp">
    
            </RelativeLayout>
            <Button
                android:id="@+id/btn1"
                android:layout_width="match_parent"
                android:layout_marginTop="10dp"
                android:layout_height="60dp"
                android:text="登录"
                android:textSize="30sp"
                android:background="#55EEAA"
                android:onClick="click"
                />
        </LinearLayout>
    </RelativeLayout>
    package com.example.myapplication;
    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.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 {
                        Toast.makeText(MainActivity.this,"登陆失败",Toast.LENGTH_SHORT).show();
                    }
                }
    
            });
    
    
        }
    }
  • 相关阅读:
    staticmethod & classmethod
    stanford Python
    LD_LIBRARY_PATH
    Centos7.2 errors
    theano profile
    电梯开关量GPIO配置记录
    定时器配置 中断配置 GPIO
    电梯开发进度贴
    Makefile编写学习摘要
    数据挖掘聚类算法--Kmeans
  • 原文地址:https://www.cnblogs.com/minmeishaonv/p/11492164.html
Copyright © 2011-2022 走看看