• 3次作业


    无理 2019/9/9 16:35:01
    package com.example.qq;
    
    import android.support.v7.app.ActionBarActivity;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;
    import android.widget.Toast;
    
    public class MainActivity extends ActionBarActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
        }
        public void tanchu(View view){
            Button button1=(Button)findViewById(R.id.button1);
            EditText textView1=(EditText)findViewById(R.id.textView1);
            EditText textView2=(EditText)findViewById(R.id.textView2);
            TextView textView3=(TextView)findViewById(R.id.textView3);
            String text1=textView1.getText().toString();
            String text2=textView2.getText().toString();
            if(text1.equals("123456")&&text2.equals("123456")) {
                    Toast.makeText(MainActivity.this,"登录成功",0).show();
                }else {
                    Toast.makeText(MainActivity.this,"登录失败",0).show();
                
                    }
            
            
        }
    
        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // Handle action bar item clicks here. The action bar will
            // automatically handle clicks on the Home/Up button, so long
            // as you specify a parent activity in AndroidManifest.xml.
            int id = item.getItemId();
            if (id == R.id.action_settings) {
                return true;
            }
            return super.onOptionsItemSelected(item);
        }
    }
    
    
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#E0FFFF"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.example.qq.MainActivity" >
    
         <EditText
             android:id="@+id/textView2"
             android:layout_width="250dp"
             android:layout_height="30dp"
             android:layout_alignLeft="@+id/textView1"
             android:layout_alignParentTop="true"
             android:layout_marginTop="180dp"
             android:background="#ffffff"
             android:ems="9"
             android:hint="密码:" >
    
             <requestFocus />
         </EditText>
    
         <Button
             android:id="@+id/button1"
             android:layout_width="130dp"
             android:layout_height="40dp"
             android:layout_below="@+id/textView1"
             android:layout_centerHorizontal="true"
             android:layout_marginTop="74dp"
             android:background="#00BFFF"
             android:onClick="tanchu"
             android:text="登录" />
    
         <EditText
             android:id="@+id/textView1"
             android:layout_width="250dp"
             android:layout_height="30dp"
             android:layout_alignBottom="@+id/textView2"
             android:layout_centerHorizontal="true"
             android:layout_marginBottom="68dp"
             android:background="#ffffff"
             android:ems="9"
             android:hint="账号:" />
    
         <ImageView
             android:id="@+id/imageView1"
             android:layout_width="50dp"
             android:layout_height="50dp"
             android:layout_above="@+id/textView1"
             android:layout_centerHorizontal="true"
             android:layout_marginBottom="32dp"
             android:src="@drawable/qq" />
    
         <TextView
             android:id="@+id/textView3"
             android:layout_width="130dp"
             android:layout_height="40dp"
             android:layout_alignLeft="@+id/button1"
             android:layout_below="@+id/button1"
             android:layout_marginTop="35dp"
             android:text="" />
    
    </RelativeLayout>

     

  • 相关阅读:
    LeetCode 189. Rotate Array
    LeetCode 965. Univalued Binary Tree
    LeetCode 111. Minimum Depth of Binary Tree
    LeetCode 104. Maximum Depth of Binary Tree
    Windows下MySQL的安装与配置
    LeetCode 58. Length of Last Word
    LeetCode 41. First Missing Positive
    LeetCode 283. Move Zeroes
    《蚂蚁金服11.11:支付宝和蚂蚁花呗的技术架构及实践》读后感
    删除docker下的镜像
  • 原文地址:https://www.cnblogs.com/DOCEAN/p/11492605.html
Copyright © 2020-2023  润新知